[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Mc Crary Test

From   "Austin Nichols" <>
Subject   Re: st: Mc Crary Test
Date   Fri, 24 Aug 2007 22:29:24 -0400

Decio Coviello--
Justin McCrary's test for a discontinuity in the density of Z (at some
point Z0 where there is a "known" discontinuity in X, the RHS variable
of interest) is described very well in the working paper by McCrary
that Arun refers to, and in a working paper by Imbens and Lemieux
(, and is mentioned briefly in (slide 66 of 85 in the
pdf). Note in particular that as McCrary points out, the bandwidth
choice is somewhat tricky.  Without regard to bandwidth choice, you
could use code similar to this simple example (modifying to suit your
specific problem as necessary):

cap prog drop discont
prog discont, rclass
version 8.2
cap drop z f0 f1
g z=_n in 1/99
kdensity share if share<50, gen(f0) at(z) nogr tri w(2)
kdensity share if share>=50, gen(f1) at(z) nogr tri w(2)
return scalar d='=f1[50]-f0[50]'

set obs 3000
g share=uniform()*100
g winvote=share>=50
bootstrap r(d), reps(50): discont

where failure to reject the null that the difference in density
estimates just to the left and just to the right of Z0 is good news
for your assumption of exchangability around the discontinuity.  You
will want to try out a few bandwidth choices in the width option of
-kdensity- (also -ssc inst kdens- for more options), and report the
results for each, and you will want many more than 50 reps in the
bootstrap.  Note also the grid for density estimates and the
discontinuity are hard-coded in the program above partly to ensure you
get estimates of f(Z) at Z0, approaching the discontinuity from both

On 8/23/07, Arun Rajamohan <> wrote:
> It is always a good idea to give the complete reference as all of us on
> statalist are not students or scholars in Economics. Many of us are
> biologists or epidemiologists or just statisticians and it does take a lot
> of time to find the references and read through the paper.
> On 23-Aug-07, at 3:59 AM, Coviello, Decio wrote:
> Hi I would like to know how to implement the Mc Crary (2007) test for the
> manipulation of the running variale in Regression Discontinuities Design.
> Thanks,
> Decio
*   For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index