The rddinterf package
estimates effects in a sharp regression discontinuity design when each
unit’s outcome may depend on its neighbors’ treatments. It uses the
distance to an effective-treatment boundary as the running variable and
allows the variance to reflect dependence through a supplied graph.
The main function requires:
Yi: the observed outcome vector;Xi: the individual running variable;neighbors: a list whose ith element
contains the observation indices of unit i’s
neighbors;W: the dependency graph, with rows and columns ordered
like Yi;contrasts: a named list of effective-treatment
contrasts; andexposure: the neighborhood exposure mapping.Each contrast has the form
list(c(d, g), c(dprime, gprime)). The first pair is placed
on the right of the distance cutoff and the second on the left.
The following small ring network illustrates the required data structures.
library(rddinterf)
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
#> Regression discontinuity estimates under interference
#> Estimator: Conventional local polynomial
#> Exposure mapping: one.treated
#> Cutoff: 0
#> Polynomial orders: p = 1, q = 2
#>
#> Estimate Std. Error 95% CI p-value N left N right
#> ov_direct 1.118 0.093 [0.935, 1.300] <0.001 36 32
#> ov_indirect -0.096 0.377 [-0.835, 0.644] 0.7996 43 36
#> direct 1.069 0.173 [0.730, 1.408] <0.001 14 9
#> spillover 0.240 0.139 [-0.032, 0.511] 0.0835 15 18ov_direct is the discontinuity in the individual running
variable and ov_indirect is the discontinuity in the
nearest neighbor score. The remaining rows correspond to the named
contrasts supplied in contrasts. Use
summary(fit) to obtain the underlying numeric summary
matrix.
Four mappings are available:
"one.treated": whether at least one neighbor is
treated;"sum.treated": the number of treated neighbors;"frac.treated": the fraction of treated neighbors;
and"majority": whether at least half of the neighbors are
treated.Use estimator = "conventional" for the conventional
local polynomial estimator or estimator = "robust" for
bias-corrected estimation and robust inference. Bandwidths are selected
automatically unless h and b are supplied.
The convergence rate depends on the codimension of the
effective-treatment boundary. If a contrast pools neighborhood strata
with different codimensions, rddinterf() reports a warning.
As established in the paper, such a pooled estimator converges to a
weighted average of boundary effects over the strata with minimum
codimension. To target effects in every stratum, estimate the
stratum-specific effects separately and aggregate them with the
appropriate density weights.