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.
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()
)A data frame containing the outcome and running variable.
Character string. Name of the outcome variable.
Character string. Name of the running variable.
Numeric. The true cutoff value of the RD design.
Numeric vector. Placebo cutoff values to test. If
NULL (the default), equally spaced cutoffs are generated
automatically from the support of x, excluding a neighbourhood
around true_cutoff.
Integer. Number of placebo cutoffs to generate when
placebo_cutoffs is NULL. Default is 10.
Character string. Kernel function for rdrobust.
Default is "tri" (triangular).
Integer. Order of the local polynomial. Default is 1.
Numeric. Confidence level for intervals. Default is
0.95.
A ggplot2 theme to apply to the plot. Default is
causalverse::ama_theme().
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.
Imbens, G. W. and Lemieux, T. (2008). "Regression Discontinuity Designs: A Guide to Practice." Journal of Econometrics, 142(2), 615-635.
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
} # }