diff_diff.StaggeredTripleDifference#

class diff_diff.StaggeredTripleDifference[source]#

Bases: CallawaySantAnnaBootstrapMixin, CallawaySantAnnaAggregationMixin

Staggered Triple Difference (DDD) estimator.

Computes group-time average treatment effects ATT(g,t) for settings with staggered adoption and a binary eligibility dimension, using the three-DiD decomposition of Ortiz-Villavicencio & Sant’Anna (2025).

Multiple comparison groups are combined via GMM-optimal (inverse-variance) weighting. Event study, group, and overall aggregations are supported.

Parameters:
  • estimation_method (str, default="dr") – Estimation method: “dr” (doubly robust), “ipw” (inverse probability weighting), or “reg” (regression adjustment).

  • alpha (float, default=0.05) – Significance level.

  • anticipation (int, default=0) – Number of anticipation periods.

  • base_period (str, default="varying") – Base period selection: “varying” (consecutive comparisons) or “universal” (always vs g-1-anticipation).

  • n_bootstrap (int, default=0) – Number of multiplier bootstrap repetitions. 0 disables bootstrap.

  • bootstrap_weights (str, default="rademacher") – Bootstrap weight distribution: “rademacher”, “mammen”, or “webb”.

  • seed (int or None, default=None) – Random seed for reproducibility.

  • cband (bool, default=True) – Whether to compute simultaneous confidence bands.

  • pscore_trim (float, default=0.01) – Propensity score trimming bound.

  • cluster (str or None, default=None) – Column name for cluster-robust standard errors.

  • rank_deficient_action (str, default="warn") – Action for rank-deficient design matrices: “warn”, “error”, “silent”.

  • epv_threshold (float, default=10) – Minimum events per variable for propensity score logistic regression. A warning is emitted when EPV falls below this threshold.

  • pscore_fallback (str, default="error") – Action when propensity score estimation fails: “error” (raise) or “unconditional” (fall back to unconditional propensity).

References

Ortiz-Villavicencio, M. & Sant’Anna, P.H.C. (2025). “Better Understanding Triple Differences Estimators.” arXiv:2505.09942v3.

Methods

__init__([estimation_method, control_group, ...])

fit(data, outcome, unit, time, first_treat, ...)

Fit the staggered triple difference estimator.

get_params()

Get estimator parameters (sklearn-compatible).

set_params(**params)

Set estimator parameters (sklearn-compatible).

Attributes

n_bootstrap

bootstrap_weights

alpha

seed

anticipation

base_period

__init__(estimation_method='dr', control_group='notyettreated', alpha=0.05, anticipation=0, base_period='varying', n_bootstrap=0, bootstrap_weights='rademacher', seed=None, cband=True, pscore_trim=0.01, cluster=None, rank_deficient_action='warn', epv_threshold=10, pscore_fallback='error')[source]#
Parameters:
  • estimation_method (str)

  • control_group (str)

  • alpha (float)

  • anticipation (int)

  • base_period (str)

  • n_bootstrap (int)

  • bootstrap_weights (str)

  • seed (int | None)

  • cband (bool)

  • pscore_trim (float)

  • cluster (str | None)

  • rank_deficient_action (str)

  • epv_threshold (float)

  • pscore_fallback (str)

classmethod __new__(*args, **kwargs)#