diff_diff.StackedDiDResults#

class diff_diff.StackedDiDResults[source]#

Bases: BaseResults

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’.

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

clean_control#

Clean control definition used.

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. 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).

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), 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

alpha

anticipation

att

balance

balance_diagnostics

clean_control

cluster_name

coef_var

SE / abs(overall ATT).

conf_int

covariates

event_study_df

event_study_vcov

event_study_vcov_index

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

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', 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:
Return type:

None

classmethod __new__(*args, **kwargs)#