diff_diff.ImputationDiDResults
- class diff_diff.ImputationDiDResults[source]
Bases:
objectResults from Borusyak-Jaravel-Spiess (2024) imputation DiD estimation.
- treatment_effects
Unit-level treatment effects with columns: unit, time, tau_hat, weight.
- Type:
pd.DataFrame
- event_study_effects
Dictionary mapping relative time h to effect dict with keys: ‘effect’, ‘se’, ‘t_stat’, ‘p_value’, ‘conf_int’, ‘n_obs’.
- Type:
dict, optional
- bootstrap_results
Bootstrap inference results.
- Type:
ImputationBootstrapResults, optional
- __init__(treatment_effects, overall_att, overall_se, overall_t_stat, overall_p_value, overall_conf_int, event_study_effects, group_effects, groups, time_periods, n_obs, n_treated_obs, n_untreated_obs, n_treated_units, n_control_units, alpha=0.05, pretrend_results=None, bootstrap_results=None, _estimator_ref=None)
- Parameters:
treatment_effects (DataFrame)
overall_att (float)
overall_se (float)
overall_t_stat (float)
overall_p_value (float)
n_obs (int)
n_treated_obs (int)
n_untreated_obs (int)
n_treated_units (int)
n_control_units (int)
alpha (float)
bootstrap_results (ImputationBootstrapResults | None)
_estimator_ref (Any | None)
- Return type:
None
Methods
__init__(treatment_effects, overall_att, ...)pretrend_test([n_leads])Run a pre-trend test (Equation 9 of Borusyak et al. 2024).
print_summary([alpha])Print summary to stdout.
summary([alpha])Generate formatted summary of estimation results.
to_dataframe([level])Convert results to DataFrame.
Attributes
Check if overall ATT is significant.
Significance stars for overall ATT.
- bootstrap_results: ImputationBootstrapResults | None = None
- print_summary(alpha=None)[source]
Print summary to stdout.
- Parameters:
alpha (float | None)
- Return type:
None
- to_dataframe(level='observation')[source]
Convert results to DataFrame.
- Parameters:
level (str, default="observation") – Level of aggregation: - “observation”: Unit-level treatment effects - “event_study”: Event study effects by relative time - “group”: Group (cohort) effects
- Returns:
Results as DataFrame.
- Return type:
pd.DataFrame
- pretrend_test(n_leads=None)[source]
Run a pre-trend test (Equation 9 of Borusyak et al. 2024).
Adds pre-treatment lead indicators to the Step 1 OLS and tests their joint significance via a cluster-robust Wald F-test.
- __init__(treatment_effects, overall_att, overall_se, overall_t_stat, overall_p_value, overall_conf_int, event_study_effects, group_effects, groups, time_periods, n_obs, n_treated_obs, n_untreated_obs, n_treated_units, n_control_units, alpha=0.05, pretrend_results=None, bootstrap_results=None, _estimator_ref=None)
- Parameters:
treatment_effects (DataFrame)
overall_att (float)
overall_se (float)
overall_t_stat (float)
overall_p_value (float)
n_obs (int)
n_treated_obs (int)
n_untreated_obs (int)
n_treated_units (int)
n_control_units (int)
alpha (float)
bootstrap_results (ImputationBootstrapResults | None)
_estimator_ref (Any | None)
- Return type:
None