Breaking changes
Reference levels for the `i()` formula syntax can no longer be set within the formula, but need to be specified via the `i_ref1` function argument to either `feols()` and `fepois()`.
New feature
A `dids2()` function is added, which implements the 2-stage difference-in-differences procedure à la Gardner and follows the syntax of kylebutts [did2s](https://github.com/kylebutts/did2s) R package.
py
from pyfixest.experimental.did import did2s
from pyfixest.estimation import feols
from pyfixest.visualize import iplot
import pandas as pd
import numpy as np
df_het = pd.read_csv("https://raw.githubusercontent.com/s3alfisc/pyfixest/master/pyfixest/experimental/data/df_het.csv")
fit = did2s(
df_het,
yname = "dep_var",
first_stage = "~ 0 | state + year",
second_stage = "~i(rel_year)",
treatment = "treat",
cluster = "state",
i_ref1 = [-1.0, np.inf],
)
fit_twfe = feols(
"dep_var ~ i(rel_year) | state + year",
df_het,
i_ref1 = [-1.0, np.inf]
)
iplot([fit, fit_twfe], coord_flip=False, figsize = (900, 400), title = "TWFE vs DID2S")
