diff_diff.StackedDiDResults#

class diff_diff.StackedDiDResults[source]#

Bases: BaseResults, AggregationMixin

Results 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:

float

overall_se#

Standard error of overall ATT (delta method on VCV).

Type:

float

overall_t_stat#

T-statistic for overall ATT.

Type:

float

overall_p_value#

P-value for overall ATT.

Type:

float

overall_conf_int#

Confidence interval for overall ATT.

Type:

tuple

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

group_effects#

Dictionary mapping cohort g to effect dict.

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

groups#

Adoption events in the trimmed set (Omega_kappa).

Type:

list

trimmed_groups#

Adoption events excluded by IC1/IC2.

Type:

list

time_periods#

All time periods in the original data.

Type:

list

n_obs#

Number of observations in the original data.

Type:

int

n_stacked_obs#

Number of observations in the stacked dataset.

Type:

int

n_sub_experiments#

Number of sub-experiments in the stack.

Type:

int

n_treated_units#

Distinct treated units across trimmed set.

Type:

int

n_control_units#

Distinct control units across trimmed set.

Type:

int

kappa_pre#

Pre-treatment event-time window size.

Type:

int

kappa_post#

Post-treatment event-time window size.

Type:

int

weighting#

Weighting scheme used.

Type:

str

control_group#

Control-group (clean-control) definition used. (The deprecated read-only alias clean_control warns and returns this value; removed in 4.0 - row M-095.)

Type:

str

alpha#

Significance level used.

Type:

float

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-time interaction columns, ordered by event_study_vcov_index. The reported per-event-time SEs are exactly sqrt(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).

Type:

list of int, optional

event_study_df#

Per-event-time inference degrees of freedom PROVENANCE: maps each estimated event time to the df actually passed to safe_inference for its stored p-value/CI (per-event Bell-McCaffrey Satterthwaite df under hc2_bm; the scalar survey df under survey designs; the df_convention-resolved analytical fallback otherwise — finite residual df under the 3.9 default, G − 1 under “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_convention configuration 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_inference actually received: the BM contrast df under hc2_bm, the survey/replicate df on survey fits, else the df_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

alpha

anticipation

att

balance

balance_diagnostics

base_period

Every sub-experiment normalizes against the single omitted reference e = -1 - anticipation - universal-base semantics in the CallawaySantAnna vocabulary.

clean_control

Deprecated alias for control_group (removed in 4.0).

cluster_name

coef_var

SE / abs(overall ATT).

conf_int

control_group

covariates

df_convention

event_study_df

event_study_vcov

event_study_vcov_index

inference_df

is_significant

Check if overall ATT is significant.

kappa_post

kappa_pre

n_clusters

n_control_units

n_obs

n_stacked_obs

n_sub_experiments

n_treated_units

p_value

reference_event_times

The singleton common reference event time, (-1 - anticipation,).

se

significance_stars

Significance stars for overall ATT.

survey_metadata

t_stat

vcov_type

weighting

overall_att

overall_se

overall_t_stat

overall_p_value

overall_conf_int

event_study_effects

group_effects

stacked_data

groups

trimmed_groups

time_periods

__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:
Return type:

None

classmethod __new__(*args, **kwargs)#