rdsensitivity
analyze the sensitivity of randomization p-values
and confidence intervals to different window lengths.
rdsensitivity(
Y,
R,
cutoff = 0,
wlist,
tlist,
statistic = "diffmeans",
p = 0,
evalat = "cutoff",
kernel = "uniform",
fuzzy = NULL,
ci,
reps = 1000,
seed = 666,
nodraw = FALSE,
quietly = FALSE
)
a vector containing the values of the outcome variable.
a vector containing the values of the running variable.
the RD cutoff (default is 0).
the list of window lengths to be evaluated. By default the program constructs 10 windows around the cutoff, the first one including 10 treated and control observations and adding 5 observations to each group in subsequent windows.
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.
the statistic to be used in the balance tests. Allowed options are diffmeans
(difference in means statistic), ksmirnov
(Kolmogorov-Smirnov statistic) and ranksum
(Wilcoxon-Mann-Whitney standardized statistic). Default option is diffmeans
. The statistic ttest
is equivalent to diffmeans
and included for backward compatibility.
the order of the polynomial for outcome adjustment model. Default is 0.
specifies the point at which the adjusted variable is evaluated. Allowed options are cutoff
and means
. Default is cutoff
.
specifies the type of kernel to use as weighting scheme. Allowed kernel types are uniform
(uniform kernel), triangular
(triangular kernel) and epan
(Epanechnikov kernel). Default is uniform
.
indicates that the RD design is fuzzy. fuzzy
can be specified as a vector containing the values of the endogenous treatment variable, or as a list where the first element is the vector of endogenous treatment values and the second element is a string containing the name of the statistic to be used. Allowed statistics are ar
(Anderson-Rubin statistic) and tsls
(2SLS statistic). Default statistic is ar
. The tsls
statistic relies on large-sample approximation.
returns the confidence interval corresponding to the indicated window length. ci
has to be a scalar or a two-dimensional vector, where the first value needs to be one of the values in wlist
. The second value, if specified, indicates the value of alpha for the confidence interval. Default alpha is .05 (95% level CI).
number of replications. Default is 1000.
the seed to be used for the randomization tests.
suppresses contour plot.
suppresses the output table.
treatment effects grid
window grid
table with corresponding p-values for each window and treatment effect pair.
confidence interval (if ci
is specified).
M.D. Cattaneo, B. Frandsen and R. Titiunik. (2015). Randomization Inference in the Regression Discontinuity Design: An Application to Party Advantages in the U.S. Senate. Journal of Causal Inference 3(1): 1-24.
M.D. Cattaneo, R. Titiunik and G. Vazquez-Bare. (2016). Inference in Regression Discontinuity Designs under Local Randomization. Stata Journal 16(2): 331-367.
M.D. Cattaneo, R. Titiunik and G. Vazquez-Bare. (2017). Comparing Inference Approaches for RD Designs: A Reexamination of the Effect of Head Start on Child Mortality. Journal of Policy Analysis and Management 36(3): 643-681.
# NOT RUN {
# 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)
# }
Run the code above in your browser using DataLab