Difference in Differences with sci-kit learn models

from sklearn.linear_model import LinearRegression

import causalpy as cp
data = cp.load_data("did")
result = cp.skl_experiments.DifferenceInDifferences(
    data,
    formula="y ~ 1 + group*post_treatment",
    time_variable_name="t",
    group_variable_name="group",
    treated=1,
    untreated=0,
    model=LinearRegression(),
)
fig, ax = result.plot()
../_images/b24f1f42620f3e46a8f0d00b492b04698577480a8b7573e2cf88db46f4a4c390.png