View source: R/rdsensitivity.R
rdsensitivity | R Documentation |
rdsensitivity
analyze the sensitivity of randomization p-values
and confidence intervals to different window lengths.
rdsensitivity( Y, R, cutoff = 0, wlist, wlist_left, tlist, statistic = "diffmeans", p = 0, evalat = "cutoff", kernel = "uniform", fuzzy = NULL, ci = NULL, ci_alpha = 0.05, reps = 1000, seed = 666, nodraw = FALSE, quietly = FALSE )
Y |
a vector containing the values of the outcome variable. |
R |
a vector containing the values of the running variable. |
cutoff |
the RD cutoff (default is 0). |
wlist |
the list of windows to the right of the cutoff. By default the program constructs 10 windows around the cutoffwith 5 observations each. |
wlist_left |
the list of windows to the left of the cutoff. If not specified, the windows are constructed symmetrically around the cutoff based on the values in wlist. |
tlist |
the list of values of the treatment effect under the null to be evaluated. By default the program employs ten evenly spaced points within the asymptotic confidence interval for a constant treatment effect in the smallest window to be used. |
statistic |
the statistic to be used in the balance tests. Allowed options are |
p |
the order of the polynomial for outcome adjustment model. Default is 0. |
evalat |
specifies the point at which the adjusted variable is evaluated. Allowed options are |
kernel |
specifies the type of kernel to use as weighting scheme. Allowed kernel types are |
fuzzy |
indicates that the RD design is fuzzy. |
ci |
returns the confidence interval corresponding to the indicated window length. |
ci_alpha |
Specifies value of alpha for the confidence interval. Default alpha is .05 (95% level CI). |
reps |
number of replications. Default is 1000. |
seed |
the seed to be used for the randomization tests. |
nodraw |
suppresses contour plot. |
quietly |
suppresses the output table. |
tlist |
treatment effects grid |
wlist |
window grid |
results |
table with corresponding p-values for each window and treatment effect pair. |
ci |
confidence interval (if |
Matias Cattaneo, Princeton University. cattaneo@princeton.edu
Rocio Titiunik, Princeton University. titiunik@princeton.edu
Gonzalo Vazquez-Bare, UC Santa Barbara. gvazquez@econ.ucsb.edu
Cattaneo, M.D., R. Titiunik and G. Vazquez-Bare. (2016). Inference in Regression Discontinuity Designs under Local Randomization. Stata Journal 16(2): 331-367.
# Toy dataset R <- runif(100,-1,1) Y <- 1 + R -.5*R^2 + .3*R^3 + (R>=0) + rnorm(100) # Sensitivity analysis # Note: low number of replications to speed up process. # The user should increase the number of replications. tmp <- rdsensitivity(Y,R,wlist=seq(.75,2,by=.25),tlist=seq(0,5,by=1),reps=500)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.