Geographic / boundary RDD on a signed distance
Usage
morie_rdd_geographic(
data,
outcome,
distance_to_boundary,
side,
bandwidth = NULL,
p = 1,
kernel = "triangular",
alpha = 0.05
)Arguments
- data
A
data.frameholding the outcome, running variable, treatment, and any covariates referenced by name.- outcome
Character; column name of the response variable in
data.- distance_to_boundary
Character; column name of the signed distance to the geographic boundary in
data.- side
Character; column name encoding the treatment side (e.g.
"left"/"right").- bandwidth
Numeric; the local-polynomial bandwidth on each side of the cutoff.
NULLinvokes the data-driven CCT selector.- p
Integer; local-polynomial order (default 1 for local- linear). 2 picks up quadratic curvature for bias correction.
- kernel
One of
"triangular"(default),"epanechnikov","uniform", or"gaussian".- alpha
Significance level (default
0.05).
Value
A named list with elements estimate, std_error, t_stat, p_value, ci_lower, ci_upper, n_obs, method, details.
Examples
set.seed(1)
n <- 400
side <- rbinom(n, 1, 0.5)
dist_to_boundary <- runif(n, 0, 1)
signed <- ifelse(side == 1, dist_to_boundary, -dist_to_boundary)
y <- 0.5 * (signed >= 0) + rnorm(n, sd = 0.3)
d <- data.frame(y, dist_to_boundary, side)
res <- morie_rdd_geographic(d, "y", "dist_to_boundary", "side")
res$estimate
#> [1] 0.510945
