Skip to contents

Wrapper around the HonestDiD methodology (Rambachan & Roth 2023) for sensitivity analysis of difference-in-differences designs to violations of the parallel trends assumption. Constructs robust confidence intervals that remain valid under bounded violations of parallel trends.

Usage

pretrend_sensitivity(
  event_study,
  ref_period = -1,
  M_seq = seq(0, 1, by = 0.1),
  method = c("C", "Delta", "Rel_Mag"),
  alpha = 0.05,
  plot = TRUE
)

Arguments

event_study

A data frame with columns period, estimate, std_error from an event study regression, or a fixest model estimated with i() interactions.

ref_period

Numeric. Reference (omitted) period. Default -1.

M_seq

Numeric vector. Grid of \(M\) values (maximum deviation from parallel trends per period). Default seq(0, 1, by = 0.1).

method

Character. Restriction type: "C" smoothness/\(\Delta\) restriction (default), "Delta" sign restriction, or "Rel_Mag" relative magnitudes.

alpha

Numeric. Significance level. Default 0.05.

plot

Logical. Produce a sensitivity plot. Default TRUE.

Value

A list with:

robust_cis

Data frame with columns period, M, ci_lower, ci_upper, estimate.

original_cis

Data frame of the original (unadjusted) event-study CIs.

breakdown_M

Scalar. Smallest \(M\) at which the robust CI for the first post-period includes zero. Inf if the CI never includes zero on this grid.

plot

A ggplot2 object (only when plot = TRUE).

Details

If the HonestDiD package is installed, its optimisation routines are used. Otherwise a simplified analytic approximation is computed: for each \(M\) the confidence interval is widened by \(M \times |t|\) on each side, where \(t\) is the distance from the reference period.

References

Rambachan, A. and Roth, J. (2023). "A More Credible Approach to Parallel Trends." Review of Economic Studies, 90(5), 2555-2591.

Examples

if (FALSE) { # \dontrun{
data(base_stagg)
mod <- feols(y ~ i(time_to_treatment, ref = -1) | id + year, base_stagg)
res <- pretrend_sensitivity(mod, M_seq = seq(0, 0.5, by = 0.05))
res$breakdown_M
res$plot
} # }