Bookmark and Share

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Cmogram, rdob, mccrary

From   "Patrick Button" <>
Subject   Re: st: Cmogram, rdob, mccrary
Date   Thu, 7 Jun 2012 03:00:38 -0700

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.


DCdensity Z, breakpoint(10) generate(Xj Yj r0 fhat se_fhat)

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:
> (concretely the file is in
> 2) DCdensity (McCrary test) :
> 3) cmogram:    
> -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 )
> Thanks for your attention,
> Antoine
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index