mfrd_est
implements the frontier approach in Wong, Steiner and Cook (2013).
It is based on the MFRDD code in Stata.
mfrd_est(
y,
x1,
x2,
c1,
c2,
t.design = NULL,
local = 0.15,
front.bw = NA,
m = 10,
k = 5,
kernel = "triangular",
ngrid = 250,
margin = 0.03,
boot = NULL,
cluster = NULL,
stop.on.error = TRUE
)
The outcome variable (continuous).
The assignment variable 1.
The assignment variable 2.
The cutoff of assignment variable 1.
The cutoff of assignment variable 2.
The treatment option according to design.
The 1st entry is for x1: "g"
means treatment is assigned
if x1 is greater than its cutoff, "geq"
means treatment is assigned
if x1 is greater than or equal to its cutoff, "l"
means treatment is assigned
if x1 is less than its cutoff, "leq"
means treatment is assigned
if x1 is less than or equal to its cutoff.
The 2nd entry is for x2.
The range of neighboring points around the cutoff on the standardized scale on each assignment variable, which is a positive number.
A numeric vector specifying the bandwidths at which to estimate the RD for each of three effects models. If NA, front.bw will be determined by cross validation.
The number of uniformly-at-random samples to draw as search candidates for front.bw if not given.
An integer specifying the number of folds for cross validation to determine front.bw if not given.
A string specifying the kernel to be used in the local linear fitting.
"triangular"
kernel is the default. Other options are
"rectangular"
, "epanechnikov"
, "quartic"
,
"triweight"
, "tricube"
, "gaussian"
and "cosine"
.
The number of non-zero grid points on each assignment variable, which is also the number of zero grid points on each assignment variable. Value used in Wong, Steiner and Cook (2013) is 2500, which may cause long computational time.
The range of grid points beyond the minimum and maximum of sample points on each assignment variable.
The number of bootstrap samples to obtain standard error of estimates.
An optional vector specifying clusters within which the errors are assumed
to be correlated. This will result in reporting cluster robust SEs. This option overrides
anything specified in se.type
. It is suggested that data with a discrete running
variable be clustered by each unique value of the running variable (Lee and Card, 2008).
Logical. If TRUE
(the default), removes bootstraps which cause
error in the integrate
function, and resample till the specified number of
bootstrap samples are acquired.
mfrd_est
returns an object of class "mfrd
".
# NOT RUN {
set.seed(12345)
x1 <- runif(1000, -1, 1)
x2 <- runif(1000, -1, 1)
cov <- rnorm(1000)
y <- 3 + 2 * (x1 >= 0) + 3 * cov + 10 * (x2 >= 0) + rnorm(1000)
mfrd_est(y = y, x1 = x1, x2 = x2, c1 = 0, c2 = 0, t.design = c("geq", "geq"))
# }
Run the code above in your browser using DataLab