diff_diff.StackedDiDResults#
- class diff_diff.StackedDiDResults[source]#
Bases:
BaseResultsResults 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’.
- 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
- 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. None when no event study was requested.- 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), or NaN when the row used normal theory, the df was undefined, or hc2_bm failed closed. None when no event study was requested.- Type:
dict, optional
Methods
__init__(overall_att, overall_se, ...[, ...])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_diagnosticscluster_namecoef_varSE / abs(overall ATT).
conf_intcovariatesis_significantCheck if overall ATT is significant.
n_clustersp_valuesesignificance_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', clean_control='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)#
- 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)
clean_control (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)
- Return type:
None
- classmethod __new__(*args, **kwargs)#