rd_power
computes the empirical probability that RD is significant,
i.e. the empirical alpha of null hypothesis: RD = 0
rd_power(num.rep = 100, sample.size = 100, x.dist = "normal",
x.para = c(0, 1), x.cut = 0, x.fuzzy = c(0, 0), x.design = NULL,
coeff = c(0.3, 1, 0.2, 0.3), eta.sq = 0.5, alpha.list = c(0.001, 0.01,
0.05))
Number of repetitions used to calculate the empirical alpha.
Number of observations in each sample.
Distribution of the assignment variable X.
"normal"
distribution is the default.
"uniform"
distribution is the only other option.
Parameters of the distribution of the assignment variable X.
If x.dist
is "normal"
, then x.para
includes the
mean and sd of normal distribution.
If x.dist
is "uniform"
, then x.para
includes the
upper and lower boundaries of uniform distribution.
Cutpoint of RD with respect to the assignment variable X.
Probabilities to be assigned to control for individuals in treatment based on cutoff, and to treatment for individuals in control based on cutoff. For a sharp design, by default, the 1st entry is 0, and the 2nd entry is 0. For a fuzzy design, the 1st entry is the probability to be assigned to control for individuals above the cutpoint, and the 2nd entry is the probability to be assigned to treatment for individuals below the cutpoint.
The treatment option according to design.
The entry is for X: "g"
means treatment is assigned
if X is greater than its cutoff, "geq"
means treatment is assigned
if X is greater than or equal to its cutoff, "l"
means treatment is assigned
if X is less than its cutoff, "leq"
means treatment is assigned
if X is less than or equal to its cutoff.
Coefficients of variables in the linear model to generate data The 1st entry is the intercept. The 2nd entry is the slope of treatment, i.e. treatment effect. The 3rd entry is the slope of assignment. The 4th entry is the slope of interaction between treatment and assignment.
Expected partial eta-squared of the linear model with respect to the treatment itself. It is used to control the variance of noise in the linear model.
List of significance levels used to calculate the empirical alpha.
rd_power
returns the results of 2 estimators as a table,
including mean, variance, and power of estimate.
The 1st Linear
results of the linear regression estimator
The 2nd Opt
results of the local linear regression estimator
of RD, with the optimal bandwidth in the IK 2012 paper.
# NOT RUN {
rd_power(x.design = "l")
rd_power(x.dist = "uniform", x.cut = 0.5, x.design = "l")
rd_power(x.fuzzy = c(0.1, 0.1), x.design = "l")
# }
Run the code above in your browser using DataLab