Window selection for RD designs under local randomization
Window selection for RD designs under local randomization
rdwinselect implements the window-selection procedure based on balance tests for RD designs under local randomization. Specifically, it constructs a sequence of nested windows around the RD cutoff and reports binomial tests for the running variable runvar and covariate balance tests for covariates covariates (if specified). The recommended window is the largest window around the cutoff such that the minimum p-value of the balance test is larger than a prespecified level for all nested (smaller) windows. By default, the p-values are calculated using randomization inference methods.
R: a vector containing the values of the running variable.
X: the matrix of covariates to be used in the balancing tests. The matrix is optional but the recommended window is only provided when at least one covariate is specified. This should be a matrix of size n x k where n is the total sample size and k is the number of covariates.
cutoff: the RD cutoff (default is 0).
obsmin: the minimum number of observations above and below the cutoff in the smallest window. Default is 10.
wmin: the smallest window to be used.
wobs: the number of observations to be added at each side of the cutoff at each step. Default is 5.
wstep: the increment in window length.
wasymmetric: allows for asymmetric windows around the cutoff when (wobs is specified).
wmasspoints: specifies that the running variable is discrete and each masspoint should be used as a window.
dropmissing: drop rows with missing values in covariates when calculating windows.
nwindows: the number of windows to be used. Default is 10.
statistic: the statistic to be used in the balance tests. Allowed options are diffmeans (difference in means statistic), ksmirnov (Kolmogorov-Smirnov statistic), ranksum (Wilcoxon-Mann-Whitney standardized statistic) and hotelling (Hotelling's T-squared statistic). Default option is diffmeans. The statistic ttest is equivalent to diffmeans and included for backward compatibility.
p: the order of the polynomial for outcome adjustment model (for covariates). Default is 0.
evalat: specifies the point at which the adjusted variable is evaluated. Allowed options are cutoff and means. Default is cutoff.
kernel: 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.
approx: forces the command to conduct the covariate balance tests using a large-sample approximation instead of finite-sample exact randomization inference methods.
level: the minimum accepted value of the p-value from the covariate balance tests. Default is .15.
reps: number of replications. Default is 1000.
seed: the seed to be used for the randomization tests.
plot: draws a scatter plot of the minimum p-value from the covariate balance test against window length.
quietly: suppress output
obsstep: the minimum number of observations to be added on each side of the cutoff for the sequence of fixed-increment nested windows. This option is deprecated and only included for backward compatibility.
Returns
window: recommended window (NA is covariates are not specified)
wlist: list of window lengths
results: table including window lengths, minimum p-value in each window, corresponding number of the variable with minimum p-value (i.e. column of covariate matrix), Binomial test p-value and sample sizes to the left and right of the cutoff in each window.
summary: summary statistics.
Examples
# Toy datasetX <- array(rnorm(200),dim=c(100,2))R <- X[1,]+ X[2,]+ rnorm(100)# Window selection adding 5 observations at each step# Note: low number of replications to speed up process.tmp <- rdwinselect(R,X,obsmin=10,wobs=5,reps=500)# Window selection setting initial window and step# The user should increase the number of replications.tmp <- rdwinselect(R,X,wmin=.5,wstep=.125,reps=500)# Window selection with approximate (large sample) inference and p-value plottmp <- rdwinselect(R,X,wmin=.5,wstep=.125,approx=TRUE,nwin=80,quietly=TRUE,plot=TRUE)