Description Usage Arguments Details Value Examples
This function computes the local composite quantile regression (LCQR) estimator of treatment effect for both sharp and fuzzy regression discontinuity (RD) designs. It also computes the bias-corrected estimator and adjusts its standard error by incorporating the variability due to bias-correction.
1 2 3 4 |
y |
A vector of treatment outcomes. |
x |
A vector of covariates. |
fuzzy |
A vector of treatment assignments in a fuzzy RD. Defaults to
|
t0 |
Treatment effect under the null. Defaults to 0. |
cutoff |
Cutoff for treatment assignment. Defaults to 0. |
q |
Number of quantiles to be used in estimation. Defaults to 5. It needs to be an odd number. |
bandwidth |
In a sharp RD, if the supplied bandwidth is a numeric vector of length two, the first element is the bandwidth for data below the cutoff and the second element is the bandwidth for data above the cutoff. In a fuzzy RD, the supplied bandwidth vector needs to have four elements in it: the first two bandwidths are for treatment outcomes below and above the cutoff and the last two bandwidths are for treatment assignments below and above the cutoff. If it is a string, the following types of bandwidth selector are provided:
|
kernel.type |
Kernel type that includes
|
maxit |
Maximum iteration number in the MM algorithm for quantile estimation. Defaults to 100. |
tol |
Convergence criterion in the MM algorithm. Defaults to 1.0e-4. |
parallel |
A logical value specifying whether to use parallel computing.
Defaults to |
numThreads |
Number of threads used in parallel computation. The option
|
grainsize |
Minimum chunk size for parallelization. Defaults to 1. |
llr.residuals |
Whether to use residuals from the local linear
regression as the input to compute the LCQR standard errors and the
corresponding bandwidths. Defaults to |
ls.derivative |
Whether to use a global quartic and quintic polynomial
to estimate the second and third derivatives of the conditional mean
function. Defaults to |
fixed.n |
Whether to compute the fixed-n results instead of asymptotic
results. If this option is turned on, all bias-correction and standard error
calculation are based on the fixed-n (nonasymptotic) approach. Defaults to
|
This is the main function of the package and it estimates the
treatment effect for both sharp and fuzzy RD designs. The LCQR estimate is
obtained from an iterative algorithm and the estimation speed is slow
compared to that of the local linear regression. Most computation time is
spend on the calculation of the standard errors. If residuals from LCQR are
used, i.e., llr.residuals = FALSE
, the code to compute the standard
error and bandwidth is paralleled and the argument numThreads
is set
to the number of physical cores minus one by default. The options
parallel
, numThreads
, and grainsize
are relevant when
llr.residuals = FALSE
.
To further speed up computation, use the option llr.residuals =
TRUE
. This is particularly suitable when the sample size is large.
The two arguments maxit
and tol
have an impact on the
computation speed. For example, using maxit = 500
and tol =
1e-6
will take much longer to complete compared to the default setting,
though the results are more precise. Our limited experience with some of
the popular RD data suggests that the treatment effect can usually be
estimated precisely with low computation cost while the standard errors may
have non-negligible change when one changes maxit
and tol
.
This certainly depends on the data. One should experiment with different
settings during estimation.
In estimating the bandwidths adj.mseone
, adj.msetwo
, and
msetwo
, we need an estimate for the second and third derivative of
the conditional mean function. By default, the second derivative is
estimated by a global quartic polynomial and the third derivative is
estimated by a global quintic polynomial. The option ls.derivative
,
when set to FLASE
, uses the LCQR method for derivative estimation.
Sometimes it can be difficult for a nonparametric method such as LCQR to
estimate derivatives of higher order, which is also true for local linear
regression.
rdcqr
returns a list with the following components:
estimate |
Treatment effect estimate and the bias-corrected treatment estimate |
se |
Asymptotic standard error and the adjusted asymptotic standard error |
bws |
Bandwidths used in estimation. There are two and four bandwidths for sharp and fuzzy RD, respectively. In a fuzzy RD, the first two bandwidths are associated with the treatment outcome variable below and above the cutoff. The last two bandwidths are associated with the treatment assignment variable below and above the curoff. |
nr_t |
The null-restricted t statistic to mitigate weak identification in a fuzzy RD. The second element is the bias-corrected and s.e.-adjusted version of this test. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Not run:
# An example of using the Head Start data.
data(headstart)
y = headstart$mortality
x = headstart$poverty
# Use the defaul rule-of-thumb bandwidth in estimation.
# Also use the residuals from a local linear regression to estimate the
# standard errors of LCQR.
rdcqr(y, x, bandwidth = "rot", llr.residuals = TRUE)
# Supply bandwidths to data below and above the cutoff 0.
# The poverty (x) variable is preprocessed to have a cutoff equal to 0.
rdcqr(y, x, bandwidth = c(10, 3), llr.residuals = TRUE)
# Try the MSE-optimal bandwidths for data below and above the cutoff.
rdcqr(y, x, bandwidth = "msetwo", llr.residuals = TRUE)
# Use residuals from a LCQR estimation when computing the standardd errors
# It is slow for large data sets but can be more accurate. By default, the option
# parallel = TRUE is used.
rdcqr(y, x, llr.residuals = FALSE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.