causalis.scenarios.did.model.EstimatorEstimator
None
Python Docs
causalis
Package entry
causalisRoot package overview and namespace mapNamespaces
causalis.scenarios.did.modelSubmodule causalis.scenarios.did.model with no child pages and 12 documented members.
Classes
Jump directly into the documented classes for this page.
Data
Jump directly into the documented data for this page.
causalis.scenarios.did.model.EstimatorNone
causalis.scenarios.did.model.AggregateKindNone
causalis.scenarios.did.model.BasePeriodNone
causalis.scenarios.did.model.CallawaySantAnnaDIDCallaway-Sant’Anna staggered-adoption DID estimator.
The model estimates group-time average treatment effects ATT(g,t) for cohorts (groups) first treated in period g and calendar times t. Estimation is performed using the doubly robust or inverse-probability weighting methods proposed by Callaway and Sant’Anna (2021).
Parameters
The estimator to use for ATT(g,t) cells. - “dr”: Doubly robust AIPW-style estimator. - “ipw”: Inverse probability weighting estimator.
Which units to use as the comparison group. - “not_yet_or_never”: Includes units not yet treated by time t and never-treated units. - “never_treated”: Includes only never-treated units.
Number of periods before actual treatment start where units are considered treated (e.g., due to announcement effects).
Definition of the ‘before’ period in the DID comparison. - “universal”: Uses g−1−anticipation as the base for all t. - “varying”: Uses t−1 as the base for all t.
Whether to estimate ATT(g,t) for t<g (pre-treatment testing).
Significance level for confidence intervals.
Whether to store diagnostic information (overlap, balance, etc.).
Clipping threshold for propensity scores to avoid division by zero.
L2 regularization strength for the logistic propensity score model.
Tolerance for the propensity score optimizer.
Maximum iterations for the propensity score optimizer.
Minimum number of treated units required in a (g,t) cell.
Minimum number of control units required in a (g,t) cell.
Minimum effective sample size for control units in a (g,t) cell.
Maximum fraction of units that can be clipped before skipping a cell.
Maximum condition number for covariate matrices.
Number of multiplier bootstrap replications for simultaneous confidence bands. If 0, uses asymptotic normal approximation for pointwise intervals.
Random seed for bootstrap multipliers.
Examples
Generate synthetic staggered-adoption panel data
Notes
In a staggered adoption design, units i are treated at different times Gi∈{g1,…,gK,∞}. The group-time average treatment effect is defined as:
where Yt(g) is the potential outcome at time t if treated at time g, and Yt(∞) is the potential outcome if never treated.
This implementation follows Callaway and Sant’Anna (2021) and uses logistic regression for propensity scores and linear regression for outcome models (in “dr” mode). The doubly robust estimator for ATT(g,t) is:
where Gg=1{G=g}, C is the control group indicator, pg(X) is the propensity score, and mg,t(X) is the outcome regression.
Simultaneous confidence bands are computed using the multiplier bootstrap on the influence functions of the ATT(g,t) estimates.
Canonical target
causalis.scenarios.did.model.CallawaySantAnnaDID
Sections
causalis.scenarios.did.model.CallawaySantAnnaDID.fitFit all supported ATT(g,t) cells on a validated :class:PanelDataDID.
This method prepares the panel data, identifies valid comparison groups for each cohort-time cell, and estimates the group-time average treatment effects.
Parameters
The validated panel data container.
Returns
The fitted model instance.
Canonical target
causalis.scenarios.did.model.CallawaySantAnnaDID.fit
Sections
causalis.scenarios.did.model.CallawaySantAnnaDID.estimateAggregate group-time effects and perform inference.
This method computes simple, cohort, calendar, and event-study aggregations from the fitted ATT(g,t) cells. It also performs inference using either asymptotic normal approximation or the multiplier bootstrap.
Parameters
Significance level. If None, uses the value from __init__.
Whether to include diagnostic data in the result. If None, uses the value from __init__.
Number of multiplier bootstrap replications. If None, uses the value from __init__.
Random seed for bootstrap. If None, uses the value from __init__.
Returns
The estimation results including aggregations and inference.
Canonical target
causalis.scenarios.did.model.CallawaySantAnnaDID.estimate
Sections
causalis.scenarios.did.model.CallawaySantAnnaDID.is_fittedWhether the model has been fitted on data.
causalis.scenarios.did.model.CallawaySantAnnaDID.support_A table of units and their inclusion status in various ATT(g,t) cells.
causalis.scenarios.did.model.CallawaySantAnnaDID.skipped_cells_A table of cohort-time cells that were skipped due to insufficient data or quality issues.
causalis.scenarios.did.model.CallawaySantAnnaDID.cell_diagnostics_Detailed diagnostic information for each ATT(g,t) cell.
Canonical target
causalis.scenarios.did.model.CallawaySantAnnaDID.cell_diagnostics_
causalis.scenarios.did.model.CallawaySantAnnaDID.__repr__causalis.scenarios.did.model.__all__[‘AggregateKind’, ‘BasePeriod’, ‘CallawaySantAnnaDID’, ‘CallawaySantAnnaDIDEstimate’, ‘Estimator’]