Tests 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()
)

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 of x, excluding a neighbourhood around true_cutoff.

n_placebo

Integer. Number of placebo cutoffs to generate when placebo_cutoffs is NULL. Default is 10.

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:

results

A data frame with columns: cutoff, is_true_cutoff, estimate, std_error, ci_lower, ci_upper, p_value, n_left, n_right.

plot

A 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
} # }