diff_diff.SunAbrahamResults

class diff_diff.SunAbrahamResults[source]

Bases: object

Results from Sun-Abraham (2021) interaction-weighted estimation.

event_study_effects

Dictionary mapping relative time to effect dictionaries with keys: ‘effect’, ‘se’, ‘t_stat’, ‘p_value’, ‘conf_int’, ‘n_groups’.

Type:

dict

overall_att

Overall average treatment effect (weighted average of post-treatment effects).

Type:

float

overall_se

Standard error of overall ATT.

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

cohort_weights

Dictionary mapping relative time to cohort weight dictionaries.

Type:

dict

groups

List of treatment cohorts (first treatment periods).

Type:

list

time_periods

List of all time periods.

Type:

list

n_obs

Total number of observations.

Type:

int

n_treated_units

Number of ever-treated units.

Type:

int

n_control_units

Number of never-treated units.

Type:

int

alpha

Significance level used for confidence intervals.

Type:

float

control_group

Type of control group used.

Type:

str

__init__(event_study_effects, overall_att, overall_se, overall_t_stat, overall_p_value, overall_conf_int, cohort_weights, groups, time_periods, n_obs, n_treated_units, n_control_units, alpha=0.05, control_group='never_treated', bootstrap_results=None, cohort_effects=None)
Parameters:
Return type:

None

Methods

__init__(event_study_effects, overall_att, ...)

print_summary([alpha])

Print summary to stdout.

summary([alpha])

Generate formatted summary of estimation results.

to_dataframe([level])

Convert results to DataFrame.

Attributes

alpha

bootstrap_results

cohort_effects

control_group

is_significant

Check if overall ATT is significant.

significance_stars

Significance stars for overall ATT.

event_study_effects

overall_att

overall_se

overall_t_stat

overall_p_value

overall_conf_int

cohort_weights

groups

time_periods

n_obs

n_treated_units

n_control_units

event_study_effects: Dict[int, Dict[str, Any]]
overall_att: float
overall_se: float
overall_t_stat: float
overall_p_value: float
overall_conf_int: Tuple[float, float]
cohort_weights: Dict[int, Dict[Any, float]]
groups: List[Any]
time_periods: List[Any]
n_obs: int
n_treated_units: int
n_control_units: int
alpha: float = 0.05
control_group: str = 'never_treated'
bootstrap_results: SABootstrapResults | None = None
cohort_effects: Dict[Tuple[Any, int], Dict[str, Any]] | None = None
__repr__()[source]

Concise string representation.

Return type:

str

summary(alpha=None)[source]

Generate formatted summary of estimation results.

Parameters:

alpha (float, optional) – Significance level. Defaults to alpha used in estimation.

Returns:

Formatted summary.

Return type:

str

print_summary(alpha=None)[source]

Print summary to stdout.

Parameters:

alpha (float | None)

Return type:

None

to_dataframe(level='event_study')[source]

Convert results to DataFrame.

Parameters:

level (str, default="event_study") – Level of aggregation: “event_study” or “cohort”.

Returns:

Results as DataFrame.

Return type:

pd.DataFrame

property is_significant: bool

Check if overall ATT is significant.

property significance_stars: str

Significance stars for overall ATT.

__init__(event_study_effects, overall_att, overall_se, overall_t_stat, overall_p_value, overall_conf_int, cohort_weights, groups, time_periods, n_obs, n_treated_units, n_control_units, alpha=0.05, control_group='never_treated', bootstrap_results=None, cohort_effects=None)
Parameters:
Return type:

None