diff_diff.SyntheticDiDResults
- class diff_diff.SyntheticDiDResults[source]
Bases:
objectResults from a Synthetic Difference-in-Differences estimation.
Combines DiD with synthetic control by re-weighting control units to match pre-treatment trends of treated units.
- __init__(att, se, t_stat, p_value, conf_int, n_obs, n_treated, n_control, unit_weights, time_weights, pre_periods, post_periods, alpha=0.05, variance_method='placebo', noise_level=None, zeta_omega=None, zeta_lambda=None, pre_treatment_fit=None, placebo_effects=None, n_bootstrap=None)
- Parameters:
att (float)
se (float)
t_stat (float)
p_value (float)
n_obs (int)
n_treated (int)
n_control (int)
alpha (float)
variance_method (str)
noise_level (float | None)
zeta_omega (float | None)
zeta_lambda (float | None)
pre_treatment_fit (float | None)
placebo_effects (ndarray | None)
n_bootstrap (int | None)
- Return type:
None
Methods
__init__(att, se, t_stat, p_value, conf_int, ...)Get time weights as a pandas DataFrame.
Get unit weights as a pandas DataFrame.
print_summary([alpha])Print the summary to stdout.
summary([alpha])Generate a formatted summary of the estimation results.
Convert results to a pandas DataFrame.
to_dict()Convert results to a dictionary.
Attributes
Check if the ATT is statistically significant at the alpha level.
Return significance stars based on p-value.
- print_summary(alpha=None)[source]
Print the summary to stdout.
- Parameters:
alpha (float | None)
- Return type:
None
- to_dict()[source]
Convert results to a dictionary.
- Returns:
Dictionary containing all estimation results.
- Return type:
Dict[str, Any]
- to_dataframe()[source]
Convert results to a pandas DataFrame.
- Returns:
DataFrame with estimation results.
- Return type:
pd.DataFrame
- get_unit_weights_df()[source]
Get unit weights as a pandas DataFrame.
- Returns:
DataFrame with unit IDs and their weights.
- Return type:
pd.DataFrame
- get_time_weights_df()[source]
Get time weights as a pandas DataFrame.
- Returns:
DataFrame with time periods and their weights.
- Return type:
pd.DataFrame
- __init__(att, se, t_stat, p_value, conf_int, n_obs, n_treated, n_control, unit_weights, time_weights, pre_periods, post_periods, alpha=0.05, variance_method='placebo', noise_level=None, zeta_omega=None, zeta_lambda=None, pre_treatment_fit=None, placebo_effects=None, n_bootstrap=None)
- Parameters:
att (float)
se (float)
t_stat (float)
p_value (float)
n_obs (int)
n_treated (int)
n_control (int)
alpha (float)
variance_method (str)
noise_level (float | None)
zeta_omega (float | None)
zeta_lambda (float | None)
pre_treatment_fit (float | None)
placebo_effects (ndarray | None)
n_bootstrap (int | None)
- Return type:
None