Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Cmogram, rdob, mccrary

 From "Patrick Button" <[email protected]> To [email protected] Subject Re: st: Cmogram, rdob, mccrary Date Thu, 7 Jun 2012 08:41:41 -0700

```1) For rdob: Based on inspection of the code, if the possible
discontinuity is c, the running variable is x, and the bandwidth is h then
it's [x-h,c)[c,x+h]. Here is a piece of the code which suggests this:

quietly count if (`c'-`h1')<=`x' & `x'<`c'
local Nh1n = r(N)
quietly count if `c'<=`x' & `x'<=(`c'+`h1')
local Nh1p = r(N)

So x=c corresponds to the treatment group.

2) For DCdensity, I reached a similar conclusion based on inspection of

--
Patrick Button

Ph.D. Candidate
Department of Economics
University of California, Irvine

> Still there is something I am not sure about:
> When one specifies the breakpoint in these commands (rdob and DCdensity),
> to which group does the breakpoint belong to?
> i.e. if the breakpoint is zero, the guys for which the running variable
> equals zero are assigned to the control group or to the treatment one?
> So when you tell Stata that the breakpoint is zero, does it
> take (x,0)[0,x) or (x,0](0,x)?
>
> Thanks,
>
> Andreu
>
>
>
>
>
> ________________________________
> From: Patrick Button <[email protected]>
> To: [email protected]
> Re: st: Cmogram, rdob, mccrary
>
> Hi Antoine,
>
> Here are responses to some of your questions.
>
> 1) The syntax for the Imbens and Kalyanaraman (2011) algorithm to compute
> the bandwidth is:
>
> syntax anything [if] [in] [,uniform detail c(real 0) fuzzy(varname)]
>
> Based on inspection of the code, it seems like you can specify any real
> number to be the value of the proposed discontinuity. Although it is
> suggested that you change the running variable so that the possible
> discontinuity is at 0, this is not required. If the possible discontinuity
> is at 10, then you just need to specify c(10).
>
> If x is your running/assignment variable, and the proposed discontinuity
> is at c, then you can shift x so the discontinuity is at c simply by:
>
> replace x = x - c
>
>
> 2) The syntax for the McCrary (2008) density test in Stata is as follows:
>
>   syntax varname(numeric) [if/] [in/], breakpoint(real) GENerate(string)
> ///
>     [ b(real 0) h(real 0) at(string) graphname(string) noGRaph]
>
> Notice the breakpoint(real). The breakpoint here refers to the point where
> there is thought to be a discontinuity.
>
> Example:
>
> DCdensity Z, breakpoint(10) generate(Xj Yj r0 fhat se_fhat)
> graphname(DCdensity_example.eps)
>
> 3) From my understanding after reading the McCrary (2008) paper, local
> linear regression is used in the test (one of the keywords for the paper
> is "Local linear density estimator").
>
> Local linear regression doesn't really work with discrete data. Lee and
> Card (2007) discuss this and how a parametric functional form is
> necessary. Basically, there is no way under a non-parametric approach to
> shrink the bandwidth to zero. Some sort of parametric functional form
> assumption is necessary. For this reason, I don't think you can really use
> the McCrary (2008) density test code with discrete data.
>
> If you were to go ahead and run the test anyways with discrete data, I am
> not sure what result you would get. It would be questionable, since
> non-parametric methods don't really make sense here, but you might get
> some sort of output.
>
> As an alternative, you could do a standard RD analysis using polynomials.
> Your Y variable would be the frequency in each discrete cell of your
> running variable, X. When you run the polynomial regression, make sure you
> cluster on X as per advice in Lee and Card (2007).
>
> 4) I've never used cmogram so i'm not help here.
>
> Anyways I hope that's helpful.
>
> --
> Patrick Button
>
> Ph.D. Candidate
> Department of Economics
> University of California, Irvine
>
>>
>> Dear statalist members,
>>
>> I am working on a Fuzzy RDD, and I have the following questions with
>> respect to the following commands which are commonly used in Regression
>> Discontinuity
>> Designs and can be found in the following websites:
>> 1) rdob: http://www.economics.harvard.edu/faculty/imbens/software_imbens
>> (concretely the file is in
>>
>> 2) DCdensity (McCrary test) :
>> http://emlab.berkeley.edu/~jmccrary/DCdensity/
>> 3) cmogram:
>> http://ideas.repec.org/c/boc/bocode/s457162.html
>>
>>
>> -The first question is, when using rdob to compute the optimal
>> bandwidth,
>> i.e.
>> rdob outcome running_variable, c(0)
>> Is rdob assuming that the treatment starts with positive values of the
>> running variable (so when the running variable is zero, there is no
>> treatment), or is it assuming that when the running variable is 0,
>> treatment is assigned?
>>
>> -The second question is exactly the same one but for the Mccrary test
>> (DCdensity command)
>>
>> -The third question is about the support of the running variable:
>> whenever
>> it is discrete, should the bin-sizes for the McCrary test be integers
>> /discrete as well?
>>
>>
>> -The fourth and last question is whether is it possible to use cmogram
>> selecting the bin size and avoiding the bins on the boundary to include
>> data points from both sides (i.e. define the bin size "x" and imposing
>> that the bins around the boundary are [-x,0), [0,x )
>>
>>
>>
>> Antoine
>>
>> *
>> *   For searches and help try:
>> *  http://www.stata.com/help.cgi?search
>> *  http://www.stata.com/support/statalist/faq
>> *  http://www.ats.ucla.edu/stat/stata/
>>
>>
>
>
>
>
> *
> *   For searches and help try:
> *  http://www.stata.com/help.cgi?search
> *  http://www.stata.com/support/statalist/faq
> *  http://www.ats.ucla.edu/stat/stata/
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```