This function allows for the estimation of treatment effects using different estimators. Currently, it supports “twfe” for the two-way fixed effects estimator and “did2s” for Gardner’s two-step DID2S estimator. Other estimators are in development.
Parameters
Name
Type
Description
Default
data
DataFrame
The DataFrame containing all variables.
required
yname
str
The name of the dependent variable.
required
idname
str
The name of the id variable.
required
tname
str
Variable name for calendar period.
required
gname
str
Unit-specific time of initial treatment.
required
cluster
Optional[str]
The name of the cluster variable. If None, defaults to idname.
None
xfml
str
The formula for the covariates.
None
estimator
str
The estimator to use. Options are “did2s”, “twfe”, and “saturated”.
'twfe'
att
bool
If True, estimates the average treatment effect on the treated (ATT). If False, estimates the canonical event study design with all leads and lags. Default is True.
True
Returns
Name
Type
Description
object
A fitted model object of class [Feols(/reference/Feols.qmd).
/home/runner/work/pyfixest/pyfixest/pyfixest/did/saturated_twfe.py:68: UserWarning: The SaturatedEventStudyClass is currently in beta. Please report any issues you may encounter.
warnings.warn(
/home/runner/work/pyfixest/pyfixest/pyfixest/estimation/feols_.py:2628: UserWarning:
22 variables dropped due to multicollinearity.
The following variables are dropped:
C(rel_time, contr.treatment(base=-1.0))[-20.0]:cohort_dummy_2000
C(rel_time, contr.treatment(base=-1.0))[-19.0]:cohort_dummy_2000
C(rel_time, contr.treatment(base=-1.0))[-18.0]:cohort_dummy_2000
C(rel_time, contr.treatment(base=-1.0))[-17.0]:cohort_dummy_2000
C(rel_time, contr.treatment(base=-1.0))[-16.0]:cohort_dummy_2000
....
warnings.warn(
/home/runner/work/pyfixest/pyfixest/pyfixest/did/saturated_twfe.py:271: UserWarning: No artists with labels found to put in legend. Note that artists whose label start with an underscore are ignored when legend() is called with no argument.
ax.legend()