Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems with DCdensity test

    I am trying to implement a DCdensity test (Mccrary test) but the command gives me a f-statistic=. (point!), suggesting that it was not possible to test the hypothesis of null discontinuity. What does it mean?

  • #2
    Welcome to Statalist.

    Please review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. Note especially sections 9-12 on how to best pose your question.

    Section 12.1 is particularly pertinent

    12.1 What to say about your commands and your problem

    Say exactly what you typed and exactly what Stata typed (or did) in response. N.B. exactly!
    You should copy commands and output from your Stata Results window and paste them into your Statalist post using CODE delimiters, as described in section 12 of the FAQ.

    Note also the advice to tell us about the user-written DCdensity command you are using, as an earlier topic did.

    https://www.statalist.org/forums/for...in-stata-graph

    The more you help others understand your problem, the more likely others are to be able to help you solve your problem.
    Last edited by William Lisowski; 16 Sep 2017, 05:49.

    Comment


    • #3
      Dear all,
      I am having problems with the output of the McCrary test in Stata. I used the command DCdensity test, and it worked well, but the f-statistic is a point instead of a value. The command I use is:

      DCdensity roa_w, breakpoint(.41956642) generate(Xj Yj r0 fhat se_fha)

      And the roa is centered in the threshold above. Even when I center the variable in 0, it gives me a f=point. Here is the output:

      DCdensity size, breakpoint(24.635288) generate(Xj Yj r0 fhat se_fha)
      Using default bin size calculation, bin size = .056605455
      Using default bandwidth calculation, bandwidth = 1.29005629

      Discontinuity estimate (log difference in height): .
      (.)
      Performing LLR smoothing.
      209 iterations will be performed

      Please can anyone tell me what am I doing wrong?


      Comment


      • #4
        I've looked at DCdensity.ado. The results you copied, when displayed in CODE delimiters, is more clearly read as
        Code:
        Discontinuity estimate (log difference in height): .
                                                           (.)
        and these are described in the ado file as the discontinuity estimate and its standard error. They are calculated with the following MATA code
        Code:
         thetahat = ln(fhatr) - ln(fhatl)
         sethetahat = sqrt( (1/(rn*h)) * (24/5) * ((1/fhatr) + (1/fhatl)) )
        where fhatr and fhatl are descbied as "local linear reg. estimates at discontinuity estimated from right and left, respectively".

        My guess is that one or both of fhatr and fhatl are zero or negative, which would result in the Stata "missing value" (not "point") displayed for both calculations. Lacking a description of your data and a copy of your plot from DCdensity, there's not much more I can say directly about your results.

        I was able to produce similar results by modifying the DCdensity example provided by the author.
        Code:
        clear
        set more off
        set seed 1234567
        graph drop _all
        set obs 10000
        gen Z=invnorm(uniform())
        gen W = Z + (Z>0) // place a large break at 0
        DCdensity Z, breakpoint(0) generate(Xj Yj r0 fhat se_fhat)
        graph rename Graph Z
        drop Xj Yj r0 fhat se_fhat
        DCdensity W, breakpoint(0) generate(Xj Yj r0 fhat se_fhat)
        graph rename Graph W
        The output from the DCdensity Z is
        Code:
        . DCdensity Z, breakpoint(0) generate(Xj Yj r0 fhat se_fhat)
        Using default bin size calculation, bin size = .019590023
        Using default bandwidth calculation, bandwidth = .743986452
        
        Discontinuity estimate (log difference in height): -.006355747
                                                           (.054922176)
        while the output from DCdensity W is
        Code:
        . DCdensity W, breakpoint(0) generate(Xj Yj r0 fhat se_fhat)
        Using default bin size calculation, bin size = .028200613
        Using default bandwidth calculation, bandwidth = .877107948
        
        Discontinuity estimate (log difference in height): .
                                                           (.)
        Below I will make a valiant effort to successfully present the graph W, which may take several attempts, since I never have any luck at this. The important point is to note is, having introduced a very large break in the running variable, the estimate from the right is clearly 0 at the break. Perhaps if you compare this graph to yours, you will see some similarities. The results suggest to me that the f-statistic is essentially infinite - there's clearly a break visible to the unaided eye!

        Click image for larger version

Name:	W.png
Views:	1
Size:	123.3 KB
ID:	1411145
        Last edited by William Lisowski; 19 Sep 2017, 19:47.

        Comment


        • #5
          statalist.gphThank you, sr. Lisowski!
          I have 3,600 obs of total assets between 2008 and 2012 for several firms in the same country. The graph I have found is attached. I am not sure about one more thing: is the value in parentheses the standard error or the p-value? If it is the standard deviation, how can I check if the discontinuity is statistically significant (pretending I have a number and not a point as an output)?
          Please let me know if you need anyelse information to guide your answer. Thanks again.
          Attached Files

          Comment


          • #6
            Yes, that graph certainly looks as if it the estimate from the left would be zero, explaining the missing values in the output.

            It is beyond my statistical ability to know how to test for statistical significance in this case. In particular, I am concerned that the assumptions surrounding the methodology might be violated, so that in theory no test is actually possible in these circumstances. I note that your breakpoint is very far into the right tail of the distribution of your running variable; none of the author's examples seem to be that extreme.

            Click image for larger version

Name:	statalist.png
Views:	1
Size:	177.8 KB
ID:	1411257

            Comment

            Working...
            X