help rdcv (http://staff.vwi.unibe.ch/kaiser/research.html)

Title

rdcv -- Sharp Regression Discontinuity Design with
Cross Validation Bandwidth Selection

Syntax

rdcv depvar indepvar [weight] [if] [in] ,
(threshold(numeric) | notrd) [options]

threshold(numeric) RD: threshold for treatment.

notrd use this option for local regression outside RD designs.

kernel(lpoly##kernel:kernel) specify kernel function

degree(#) use polynomial of order #

strict treatment is strictly above threshold (RD only)

vce(vcetype) variance estimator at threshold

cross validation (CV) options
ngrid(integer) specify number of grid points

gridpoints(numlist) user-specified grid

cvsample(numeric) window around threshold to use for CV in % of sample

wide use wide grid

other bandwidth choice methods
ikbwidth uses Imbens-Kalyanaraman bandwidth instead of CV.

rotbwidth uses ROT plug-in bandwidth instead of CV.

bwidth(numlist) user's bandwidth choice

define estimation points / save estimates
at(varname) estimate reg. function at values specified in varname

n(#) estimate reg. function at # points

generate(newvar) save estimates of reg. function in newvar

se(newvar) save estimates of standard error in newvar

graph options
ci plots a confidence interval

level(numeric) specifies the confidence level

gropt options for the combined graph

lineopt options of the line plot

areaopt options for the CI area plot

scatopt options for the scatter plot

noscatter suppresses the scatter plot

nograph suppresses the graph

aweights and fweights are allowed; see weight.

Description

The command rdcv
implements estimation of (sharp) regression discontinuity
designs (RD) using a flexible cross-validation (CV) procedure for
optimal bandwidth selection.
The CV criterion minimizes the integrated mean squared error
(see e.g. Hanson 2014, Ch. 11.6).
Estimation is based on nonparametric kernel methods
(local linear or local polynomial regression).

The bandwidth is determined automatically by an adaptive grid search,
but the user may also specify his own set of gridpoints. As alternatives
to the CV bandwidth, the module can also compute bandwidths
based on the plug-in method (Stata default in lpoly) or based
on the method in Imbens and Kalyanaraman (2012).

Options

threshold(numeric) is required for the sharp regression
discontinuity (RD) design. It is the value of indepvar corresponding
to the discontinuity. It generates D=(indepvar>=threshold).

notrd can be used to perform local kernel regression
outside RD designs, similar to the lpoly command.
The difference is that bandwidth selection is based on cross validation.

"kernel(lpoly##kernel:kernel)" specifies the
kernel function. Default is triangular.

degree(#) specifies the polynomial degree
of order #. Default is local linear regression, i.e. degree=1.

strict allows the user to specify the treatment as a strict
inequality: D=(indepvar>threshold).

vce(vcetype) specifies the variance estimator for
the estimation of the discontinuity.

ngrid(integer) specifies the number of grid points for the
cross validation (CV) procedure. The default is 20.

gridpoints(numlist) allows the user to specify the gridpoints
for the cross-validation (CV) procedure. Per default, the lowest (highest) grid point is half
(twice) the pilot bandwidth determined by the rule-of-thumb method.

cvsample(numeric) allows the user to specify that only the x% closest
observations on each side of the threshold are used in the CV procedure. Default is to
use all observations. Example: cvsample(50 50) requests that only the closest
50% of observations on both sides of the threshold are used.

wide widens the default grid. This option should be used if the
minimum MSE is in the corner of the grid.

ikbwidth computes the optimal bandwidth according to the method
of Imbens and Kalyanaraman (2012) instead of the CV method.

rotbwidth computes the optimal bandwidth according to the
plug in method (ROT) as performed by the lpoly command.

bwidth(numlist) overrides the optimal CV bandwidth with the user's
choice. The option takes two numbers in the RD case and one
number otherwise.

at(varname) estimates the regression function at the
values specified in the variable varname.

n(#) estimates the regression function at # points. The
points are computed uniformly from the 1st to the 99th percentile of the
support of the independent variable.

generate(newvar) saves estimates of the regression
function in the variable newvar.

se(newvar) saves estimates of the standard error of
the regression function in the variable newvar.

ci requests a confidence interval to be included in the plot.

level(numeric) specifies the confidence level when ci
is specified. Default is a 95% interval.

gropt(options list) allows the user to pass on twoway_options
options to edit the combined graph. Default is
"scheme(s1mono) legend(content depends on options)
yti(label depvar) xti(label indepvar) xli(threshold value, lp(dash))"

lineopt(options list) allows the user to pass on
line options to edit the line plot. Default is "sort lc(navy)".

areaopt(options list) allows the user to pass on rarea
options to edit the rarea plot (confidence band).
Default is "sort lc(gs13) fc(gs13)".

scatopt(options list) allows the user to pass on scatter
options to edit the scatter plot. Default is "m(O) mc(green)".

noscatter supresses the production of the scatter plot.

nograph supresses the production of the graph.

Example

/* Simulated Example */

clear

set obs 200

set seed 123

g double x = runiform() * 6

g y = (x>3) + sin(x) + 0.1*rnormal()

rdcv y x , thr(3) ci

rdcv y x , thr(3) ci kernel(rec) deg(3)

rdcv y x , thr(3) ci ngrid(10)

rdcv y x , thr(3) ci gen(mymu) se(myse)

Saved results (depending on options)

rdcv saves the following in r():

Scalars

r(jump) estimate of treatment effect (RD)

r(se_jump) standard error of r(jump) (RD)

r(b1) estimate below threshold (RD)

r(se1) standard error of r(b1) (RD)

r(b0) estimate above threshold (RD)

r(se0) standard error of r(b0) (RD)

r(bw0) bandwidth below threshold (RD)

r(bw1) bandwidth above threshold (RD)

r(N0) # observations below threshold (RD)

r(N1) # observations above threshold (RD)

Macros

r(threshold) threshold value (RD)

r(degree) polynomial degree

r(kernel) kernel function

r(depvar) dependent variable

r(indepvar) independent variable

Matrices

r(R) estimation results from table (RD)

r(cv_bw0) cross-validation criteria below threshold

r(cv_bw1) cross-validation criteria above threshold (RD)

Requirements

This command requires the packages distinct and moremata
that you can find by typing findit distinct and findit moremata,
respectively.

References

Imbens, Guido, and Karthik Kalyanaraman.
"Optimal bandwidth choice for the regression discontinuity estimator."
The Review of Economic Studies 79.3 (2012): 933-959.

Hanson, Bruce E. 2014. Econometrics. University of Wisconsin.
http://www.ssc.wisc.edu/~bhansen/econometrics/Econometrics.pdf.

Please cite rdcv as follows

Kaiser, Boris (2014). "RDCV: Stata module to estimate sharp regression discontinuity
designs using cross-validation bandwidth selection", University of Bern.

Disclaimer

THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.

IN NO EVENT WILL THE COPYRIGHT HOLDERS OR THEIR EMPLOYERS, OR ANY OTHER PARTY WHO
MAY MODIFY AND/OR REDISTRIBUTE THIS SOFTWARE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM.

Author

For questions, queries or suggestions, please contact

Boris Kaiser, bo.kaiser@gmx.ch