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

# Re: st: Local Linear Regression for Regression Discontinuity Designs

 From Austin Nichols To statalist@hsphsun2.harvard.edu Subject Re: st: Local Linear Regression for Regression Discontinuity Designs Date Tue, 7 Jun 2011 10:38:50 -0400

```Jen Zhen <jenzhen99@gmail.com>:

Part of the question is easy; compare:

sysuse auto, clear
ren price y
gen x = length - 193
gen z = (x >= 0)
gen z_x = z*x
reg y z x z_x if x>=-10&x<=10
reg y z x z_x if x>-10&x<10
rd_obs y x, bw(10) kernel(rectangle) mbw(100)
rd_obs y x, bw(10) kernel(rectangle) mbw(100)

First, the rectangular kernel used by -lpoly- does not use the
endpoints of the interval.

Second, note that the first time through, Stata refuses to post the
results, but a second run does not choke on e(sample).  Not sure why
yet.

Third, -rd_obs- always reports the total number of obs in sample
(meeting -if- and -in- restrictions) in the returned e(N) since it is
designed to work with multiple bandwidths (meaning one could in theory
have ten or a hundred different N values for different reported
estimates).

On Tue, Jun 7, 2011 at 8:26 AM, Jen Zhen <jenzhen99@gmail.com> wrote:
> Andreas, Alex and Austin,
>
> I came across this "triple A" post and tried Austin's suggestions
> myself, i.e. I obtained the latest version of -rd- and -rd_obs- with
> -net from (the UMichigan website given my Austin)- and then used the
> following code:
>
> sysuse auto, clear
> ren price y
> gen x = length - 193
> gen z = (x >= 0)
> gen z_x = z*x
> reg y z x z_x if inrange(x,-10,10) mbw(10)
> rd_obs y x, bw(10) kernel(rectangle).
> Following the suggestions in this thread, I expected to get the same
> result with both commands, but in practice the first gave me
> -7002.956 and the second gave me -7109.5027.
>
> Would Austin or one of the others by any chance be able to see why this is?
>
> Sidenote 1: the latter command also returns the error message
> "esample() invalid", albeit only after giving me the estimation
> results.
> Sidenote 2: When, after use of -rd_obs-, I type -scalar obs=e(N)- and
> then -disp obs-, I always get 74, regardless of which bandwidth I
> specify in the respective rd_obs option, and that 74 is also larger
> than the 22 observations used when I do the regression manually with
> -reg-. So I'm wondering whether possibly the -bw- option is not
> working properly (or I'm misusing it)?
>
> Thanks a lot and all best,
> JZ
>

*
*   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/
```