Package 'rddinterf'

Title: Estimation of Causal Effects in Regression Discontinuity Designs Under Interference
Description: Implements the distance-based local polynomial estimators proposed by Dal Torrione, Arduini, and Forastiere (2024) <doi:10.48550/arXiv.2410.02727> for sharp regression discontinuity designs when outcomes may depend on the treatment assignments of connected units. The package constructs effective-treatment boundaries, estimates direct and indirect effects, and provides network-robust inference.
Authors: Elena Dal Torrione [aut, cre], Tiziano Arduini [aut], Laura Forastiere [aut] (ORCID: <https://orcid.org/0000-0003-3721-9826>)
Maintainer: Elena Dal Torrione <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-12-04 20:04:58 UTC
Source: https://github.com/cran/rddinterf

Help Index


Construct effective treatment boundaries

Description

Builds boundary objects describing the separating set between two effective treatment regions under a specified exposure mapping.

Usage

get_boundary(neighbors, contrast, exposure)

Arguments

neighbors

List of neighbor indices for each observation.

contrast

A length-2 list describing the two effective treatments to compare.

exposure

Character string specifying the exposure mapping. Supported values currently include "one.treated", "sum.treated", "frac.treated", and "majority".

Value

An object of class "rdd_boundary". Each element corresponds to a distinct neighborhood size and contains the information needed to describe the effective treatment boundary.

Examples

neighbors <- list(c(2, 3), c(1, 3), c(1, 2))
contrast <- list(c(1, 1), c(0, 0))
get_boundary(neighbors, contrast, exposure = "one.treated")

Print a boundary object

Description

Displays a human-readable representation of a boundary object, listing each interference set along with its size and description.

Usage

## S3 method for class 'rdd_boundary'
print(x, ...)

Arguments

x

An object of class "rdd_boundary".

...

Additional arguments (ignored).

Details

Boundary objects are typically created using get_boundary.

Value

The input object, invisibly.


Print rddinterf estimation results

Description

Displays the estimation method and design settings followed by a compact table of effect estimates. The full boundary objects, distance variables, bandwidths, and estimation samples remain available in the fitted object.

Usage

## S3 method for class 'rddinterf'
print(x, digits = 3, ...)

Arguments

x

An object of class "rddinterf".

digits

Number of digits shown for estimates, standard errors, and confidence intervals.

...

Additional arguments (ignored).

Value

The input object, invisibly.


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

Summarize rddinterf estimation results

Description

Produces a compact summary table for objects returned by rddinterf.

Usage

## S3 method for class 'rddinterf'
summary(object, ...)

Arguments

object

An object of class "rddinterf".

...

Additional arguments (ignored).

Value

A numeric matrix with columns:

Estimate

Point estimate.

S.E.

Estimated standard error.

CI.l

Lower endpoint of the 95% confidence interval.

CI.u

Upper endpoint of the 95% confidence interval.

p.value

Two-sided p-value based on a normal approximation.

N.l

Effective sample size to the left of the cutoff.

N.r

Effective sample size to the right of the cutoff.