class differences.ATTgt

Group-Time ATT

Difference in differences estimation and inference fot the following use cases

  • balanced panels, unbalanced panels or repeated cross-section

  • two or multiple periods

  • fixed or staggered treatment timing

  • binary or multi-valued treatment

  • heterogeneous treatment effects

Parameters:
data : DataFrame

pandas DataFrame

df = df.set_index(['entity', 'time'])

where df is the dataframe to use, ‘entity’ should be replaced with the name of the entity column and ‘time’ should be replaced with the name of the time column.

cohort_name : str

cohort name

base_period : str, default: "varying"

  • "universal"

  • "varying"

anticipation : int, default: 0

The number of time periods before participating in the treatment where units can anticipate participating in the treatment, and therefore it can affect their untreated potential outcomes

strata_name : str, default: None

The name of the column to be used in case of multi-valued treatment, used to calculate cohort-time-stratum ATT.

If stratum name is None, fit() will return cohort-time ATT.

freq : str | None, default: None

the date frequency of the panel data. Required if the time index is datetime. For example, if the time column is a monthly datetime then freq=’M’. Check offset aliases, for a list of available frequencies.

Public members

data

Constructors

ATTgt(data: DataFrame, cohort_name: str, ...)

Initialize self. See help(type(self)) for accurate signature.

Methods

aggregate(...) DataFrame

Aggregate the ATTgt

estimation_details(type_of_aggregation: str = None)
fit(formula: str, weights_name: str = None, ...) DataFrame

Computes the cohort-time-(stratum) average treatment effects:

group_time(feasible: bool = False) list[dict]
Returns:

  • a list of dictionaries where each dictionary keys are

  • cohort, base_period, time, (stratum)

results(type_of_aggregation: str = None, overall: bool = False, ...)

provides easy access to cached results. this method must be called after fit and/or aggregate depending on the parameters requested

Properties

property sample_names
property wald_pre_test