
RD Placebo Cutoff Test
rd_placebo_cutoffs.RdTests the validity of the RD design by estimating treatment effects at placebo cutoff values where no discontinuity should exist. A significant effect at a placebo cutoff may indicate a violation of the RD assumptions.
Usage
rd_placebo_cutoffs(
data,
y,
x,
true_cutoff,
placebo_cutoffs = NULL,
n_placebo = 10,
kernel = "tri",
p = 1,
conf_level = 0.95,
theme_use = causalverse::ama_theme()
)Arguments
- data
A data frame containing the outcome and running variable.
- y
Character string. Name of the outcome variable.
- x
Character string. Name of the running variable.
- true_cutoff
Numeric. The true cutoff value of the RD design.
- placebo_cutoffs
Numeric vector. Placebo cutoff values to test. If
NULL(the default), equally spaced cutoffs are generated automatically from the support ofx, excluding a neighbourhood aroundtrue_cutoff.- n_placebo
Integer. Number of placebo cutoffs to generate when
placebo_cutoffsisNULL. Default is10.- kernel
Character string. Kernel function for
rdrobust. Default is"tri"(triangular).- p
Integer. Order of the local polynomial. Default is
1.- conf_level
Numeric. Confidence level for intervals. Default is
0.95.- theme_use
A ggplot2 theme to apply to the plot. Default is
causalverse::ama_theme().
Value
A list with components:
resultsA data frame with columns:
cutoff,is_true_cutoff,estimate,std_error,ci_lower,ci_upper,p_value,n_left,n_right.plotA ggplot2 object showing estimates and CIs at each cutoff, with the true cutoff highlighted.
References
Imbens, G. W. and Lemieux, T. (2008). "Regression Discontinuity Designs: A Guide to Practice." Journal of Econometrics, 142(2), 615-635.
Examples
if (FALSE) { # \dontrun{
set.seed(42)
n <- 2000
x <- runif(n, -1, 1)
y <- 3 + 2 * (x >= 0) + 0.5 * x + rnorm(n)
df <- data.frame(y = y, x = x)
result <- rd_placebo_cutoffs(
data = df,
y = "y",
x = "x",
true_cutoff = 0,
placebo_cutoffs = c(-0.5, -0.25, 0.25, 0.5)
)
result$plot
result$results
} # }