diff_diff.Comparison2x2#

class diff_diff.Comparison2x2[source]#

Bases: object

A single 2x2 DiD comparison in the Bacon decomposition.

treated_group#

The timing group used as “treated” in this comparison.

Type:

Any

control_group#

The timing group used as “control” in this comparison. For comparison_type="treated_vs_never", this is the literal string "never_treated", which refers to the post-remap U bucket (the paper’s U per Goodman-Bacon 2021 footnote 11). On inputs with no remapped always-treated units this is exactly the true never-treated set; with remapping it is the broader U bucket. Check BaconDecompositionResults.n_never_treated and n_always_treated_remapped for the precise composition.

Type:

Any

comparison_type#

Type of comparison: “treated_vs_never”, “earlier_vs_later”, or “later_vs_earlier”.

Type:

str

estimate#

The 2x2 DiD estimate for this comparison.

Type:

float

weight#

The weight assigned to this comparison in the TWFE average.

Type:

float

n_treated#

Number of treated observations in this comparison.

Type:

int

n_control#

Number of control observations in this comparison.

Type:

int

time_window#

The (start, end) time period for this comparison.

Type:

Tuple[float, float]

Methods

__init__(treated_group, control_group, ...)

Attributes

__init__(treated_group, control_group, comparison_type, estimate, weight, n_treated, n_control, time_window)#
Parameters:
Return type:

None

classmethod __new__(*args, **kwargs)#