diff_diff.StackedDiDResults#
- class diff_diff.StackedDiDResults[source]#
Bases:
BaseResults,AggregationMixinResults from Stacked DiD estimation (Wing, Freedman & Hollingsworth 2024).
- overall_att#
Overall average treatment effect on the treated (average of post-treatment event-study coefficients).
- Type:
- event_study_effects#
Dictionary mapping event time h to effect dict with keys: ‘effect’, ‘se’, ‘t_stat’, ‘p_value’, ‘conf_int’, ‘n_obs’. Always populated on 3.9+ fits (the pooled regression always includes the event-time interactions and the surface is always extracted - row M-024); None only on pre-3.9 pickles. View it as the unified container via
aggregate('event_study').- Type:
dict, optional
- stacked_data#
Full stacked dataset with _sub_exp, _event_time, _D_sa, _Q_weight columns. Accessible for custom analysis.
- Type:
pd.DataFrame
- control_group#
Control-group (clean-control) definition used. (The deprecated read-only alias
clean_controlwarns and returns this value; removed in 4.0 - row M-095.)- Type:
- event_study_vcov#
Full event-study variance-covariance matrix: the sub-block of the pooled stacked-regression coefficient covariance over the estimated
D_sa x event-timeinteraction columns, ordered byevent_study_vcov_index. The reported per-event-time SEs are exactlysqrt(diag())of this matrix in every inference mode (analytical hc1/hc2_bm sandwich, survey replicate refit, and survey TSL all produce the coefficient covariance the SEs are read from). The reference period is synthesized, never a regression column, so it is absent from the index. Always populated on 3.9+ fits (the event-study surface is always materialized - row M-024); None only on pre-3.9 pickles.- Type:
np.ndarray, optional
- event_study_vcov_index#
Event-time labels ordering
event_study_vcov’s rows/columns (the estimated event times, reference excluded).
- event_study_df#
Per-event-time inference degrees of freedom PROVENANCE: maps each estimated event time to the df actually passed to
safe_inferencefor its stored p-value/CI (per-event Bell-McCaffrey Satterthwaite df underhc2_bm; the scalar survey df under survey designs; thedf_convention-resolved analytical fallback otherwise — finite residual df under the 3.9 default,G − 1under “cluster”), or NaN when the row used normal theory (df_convention="normal"), the df was undefined, or hc2_bm failed closed. Always populated on 3.9+ fits (row M-024); None only on pre-3.9 pickles.- Type:
dict, optional
- df_convention#
The estimator’s
df_conventionconfiguration echoed onto the results (“residual” | “cluster” | “normal”; added 3.9).- Type:
str, optional
- inference_df#
The df the stored overall-ATT p-value/CI’s
safe_inferenceactually received: the BM contrast df underhc2_bm, the survey/replicate df on survey fits, else thedf_convention-resolved analytical fallback. None when the overall inference used normal theory or failed closed.- Type:
float, optional
Methods
__init__(overall_att, overall_se, ...[, ...])aggregate(type[, weights, balance_e])Re-aggregate this fit without refitting.
print_summary([alpha])Print summary to stdout.
summary([alpha])Generate formatted summary of estimation results.
to_dataframe([level])Convert results to DataFrame.
to_dict()Convert headline results to a dictionary.
Attributes
anticipationattbalancebalance_diagnosticsbase_periodEvery sub-experiment normalizes against the single omitted reference
e = -1 - anticipation- universal-base semantics in the CallawaySantAnna vocabulary.clean_controlDeprecated alias for
control_group(removed in 4.0).cluster_namecoef_varSE / abs(overall ATT).
conf_intcovariatesis_significantCheck if overall ATT is significant.
n_clustersp_valuereference_event_timesThe singleton common reference event time,
(-1 - anticipation,).sesignificance_starsSignificance stars for overall ATT.
survey_metadatat_statvcov_type- __init__(overall_att, overall_se, overall_t_stat, overall_p_value, overall_conf_int, event_study_effects, group_effects, stacked_data, groups=<factory>, trimmed_groups=<factory>, time_periods=<factory>, n_obs=0, n_stacked_obs=0, n_sub_experiments=0, n_treated_units=0, n_control_units=0, kappa_pre=1, kappa_post=1, weighting='aggregate', control_group='not_yet_treated', alpha=0.05, anticipation=0, vcov_type='hc1', cluster_name=None, n_clusters=None, survey_metadata=None, balance='none', covariates=None, balance_diagnostics=None, event_study_vcov=None, event_study_vcov_index=None, event_study_df=None, df_convention=None, inference_df=None)#
- Parameters:
overall_att (float)
overall_se (float)
overall_t_stat (float)
overall_p_value (float)
stacked_data (DataFrame)
n_obs (int)
n_stacked_obs (int)
n_sub_experiments (int)
n_treated_units (int)
n_control_units (int)
kappa_pre (int)
kappa_post (int)
weighting (str)
control_group (str)
alpha (float)
anticipation (int)
vcov_type (str)
cluster_name (str | None)
n_clusters (int | None)
survey_metadata (Any | None)
balance (str)
event_study_vcov (ndarray | None)
df_convention (str | None)
inference_df (float | None)
- Return type:
None
- classmethod __new__(*args, **kwargs)#