rddinterf: Estimate regression discontinuity effects under interference

View source: R/estimation.R

rddinterfR Documentation

Estimate regression discontinuity effects under interference

Description

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.

Usage

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
)

Arguments

Yi

Numeric vector of observed outcomes.

Xi

Numeric vector of individual running variables.

neighbors

List whose ith element contains the observation indices of unit i's neighbors.

W

Binary dependency graph, with rows and columns ordered like Yi. Base and sparse matrices are supported.

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 "one.treated", "sum.treated", "frac.treated", and "majority".

boundary

Optional named list of boundary objects returned by get_boundary(). If NULL, boundaries are constructed internally.

cutoff

Numeric cutoff defining treatment assignment. Default is 0.

subset

Optional logical vector indicating the subset of observations to use.

estimator

Character string specifying the estimator. Must be one of "conventional" or "robust".

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 TRUE, compute the overall direct effect.

overall_indirect

Logical; if TRUE, compute the overall indirect effect.

Details

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.

Value

An object of class "rddinterf" with components:

estimates

Named list of estimation results.

boundary

List of boundary objects used for estimation.

exposure

Exposure mapping used.

estimator

Estimation method used.

cutoff

Cutoff used to define treatment.

p

Order of the main local polynomial fit.

q

Order of the bias-correction fit.

call

Matched function call.

Each element of estimates is either NA or a list containing:

est

Point estimate.

se

Estimated standard error.

ci

95% confidence interval.

mean_left

Estimated conditional mean at the boundary from the left.

mean_right

Estimated conditional mean at the boundary from the right.

boundary

Boundary object or boundary description.

dstar

Signed running variable used for estimation.

Yi

Outcome vector in the estimation sample.

N_r

Effective sample size to the right of the cutoff.

N_l

Effective sample size to the left of the cutoff.

h

Bandwidth used for estimation.

b

Bandwidth used for bias correction.

tr

Logical indicator for the estimation sample.

p

Order of the main local polynomial fit.

q

Order of the bias-correction fit.

Examples

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


rddinterf documentation built on Dec. 4, 2026, 5:10 p.m.