| rddinterf | R Documentation |
Estimates overall direct effects, overall indirect effects, and specific interference effects in regression discontinuity designs with interference using distance-based local polynomial estimators and network-robust variance estimators.
rddinterf(
Yi,
Xi,
neighbors,
W,
contrasts,
exposure,
boundary = NULL,
cutoff = 0,
subset = NULL,
estimator = c("conventional", "robust"),
p = 1,
q = p + 1,
h = NULL,
b = NULL,
overall_direct = TRUE,
overall_indirect = TRUE
)
Yi |
Numeric vector of observed outcomes. |
Xi |
Numeric vector of individual running variables. |
neighbors |
List whose |
W |
Binary dependency graph, with rows and columns ordered like |
contrasts |
Named list of effective treatment contrasts to estimate. Each element should define a treated and control effective treatment. |
exposure |
Character string specifying the exposure mapping. Supported
values currently include |
boundary |
Optional named list of boundary objects returned by
|
cutoff |
Numeric cutoff defining treatment assignment. Default is |
subset |
Optional logical vector indicating the subset of observations to use. |
estimator |
Character string specifying the estimator. Must be one of
|
p |
Integer specifying the order of the local polynomial estimator. |
q |
Integer specifying the order of the local polynomial estimator used for bias correction. |
h |
Optional manual bandwidth for estimation. Can be a scalar, named vector, or named list. |
b |
Optional manual bandwidth for bias correction. Can be a scalar, named vector, or named list. |
overall_direct |
Logical; if |
overall_indirect |
Logical; if |
The function supports two estimators:
"conventional"Local polynomial estimator without bias correction.
"robust"Bias-corrected local polynomial estimator with robust inference.
The own treatment indicator is computed internally from Xi and cutoff.
The neighbors' running-variable lists and neighborhood treatments are also
computed internally from Xi, neighbors, and exposure.
If a contrast pools active neighborhood strata with different boundary codimensions, the function issues a warning. In that setting, the pooled estimator converges to an effect over the minimum-codimension strata. Effects for every stratum should instead be estimated separately and aggregated with the appropriate density weights.
An object of class "rddinterf" with components:
estimatesNamed list of estimation results.
boundaryList of boundary objects used for estimation.
exposureExposure mapping used.
estimatorEstimation method used.
cutoffCutoff used to define treatment.
pOrder of the main local polynomial fit.
qOrder of the bias-correction fit.
callMatched function call.
Each element of estimates is either NA or a list containing:
estPoint estimate.
seEstimated standard error.
ci95% confidence interval.
mean_leftEstimated conditional mean at the boundary from the left.
mean_rightEstimated conditional mean at the boundary from the right.
boundaryBoundary object or boundary description.
dstarSigned running variable used for estimation.
YiOutcome vector in the estimation sample.
N_rEffective sample size to the right of the cutoff.
N_lEffective sample size to the left of the cutoff.
hBandwidth used for estimation.
bBandwidth used for bias correction.
trLogical indicator for the estimation sample.
pOrder of the main local polynomial fit.
qOrder of the bias-correction fit.
set.seed(123)
n <- 80
Xi <- runif(n, -1, 1)
neighbors <- lapply(seq_len(n), function(i) {
c(if (i == 1) n else i - 1L, if (i == n) 1L else i + 1L)
})
W <- diag(n)
for (i in seq_len(n)) W[i, neighbors[[i]]] <- 1
W <- (W + t(W) > 0) * 1
Di <- as.integer(Xi >= 0)
Gi <- as.numeric(vapply(neighbors, function(j) any(Di[j] == 1), logical(1)))
Yi <- 1 + Di + 0.3 * Gi + 0.5 * Xi + rnorm(n, sd = 0.2)
contrasts <- list(
direct = list(c(1, 0), c(0, 0)),
spillover = list(c(0, 1), c(0, 0))
)
fit <- rddinterf(
Yi, Xi, neighbors, W, contrasts, exposure = "one.treated",
estimator = "conventional", h = 0.8, b = 1
)
fit
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.