R3D brings your regression discontinuity designs into the third dimension by handling distributional outcomes instead of just scalar responses. When your treatment effect isn’t just a single number but an entire distribution shift, R3D has you covered!
# Install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("Davidvandijcke/R3D")
# Or once on CRAN:
# install.packages("R3D")
library(R3D)
# Simulate data
set.seed(123)
n <- 100
X <- runif(n, -1, 1) # Running variable
Y_list <- lapply(seq_len(n), function(i) {
# Distribution is Normal with mean depending on X
rnorm(sample(30:50, 1), mean = 2 + 2 * (X[i] >= 0))
})
# Sharp RDD with distributional outcome
fit <- r3d(X, Y_list, cutoff = 0,
method = "frechet", p = 2,
boot = TRUE, boot_reps = 200)
# Visualize the results
plot(fit)
# Examine detailed results
summary(fit)
R3D uses advanced local polynomial and Fréchet regression techniques to estimate how an entire distribution changes at a discontinuity threshold when treatment is at a higher level of aggregation than the outcome variable. Instead of just estimating E[Y|X] at the cutoff, we estimate the entire average conditional quantile function Q_Y(τ|X) at the threshold. Note the word average! Unlike traditional quantile RDD, we are now sampling random distributions, which requires a different approach to estimation and inference. For more details on this fascinating subject, check out the supporting paper by Van Dijcke (that’s me!) (2025 (that’s now!)).
If you use R3D in your research, please cite:
Van Dijcke, D. (2025). Regression Discontinuity Design with Distributional Outcomes.
Working paper.
Check out the full documentation for tutorials, examples, and detailed function references.