Skip to content

Add documentation for did multi period with repeated cross sections #243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 7, 2025
Merged
27 changes: 25 additions & 2 deletions doc/examples/did/py_panel.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"source": [
"### Data Details\n",
"\n",
"*Here, we slightly abuse the definition of the potential outcomes. $Y_{i,t}(1)$ corresponds to the (potential) outcome if unit $i$ would have received treatment at time period $\\mathrm{g}$ (where the group $\\mathrm{g}$ is drawn with probabilities based on $Z$).*\n",
"Here, we slightly abuse the definition of the potential outcomes. $Y_{i,t}(1)$ corresponds to the (potential) outcome if unit $i$ would have received treatment at time period $\\mathrm{g}$ (where the group $\\mathrm{g}$ is drawn with probabilities based on $Z$).\n",
"\n",
"More specifically\n",
"\n",
Expand Down Expand Up @@ -873,7 +873,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### All combinations\n",
"### All Combinations\n",
"\n",
"The option `gt_combinations=\"all\"` includes all relevant group time values with $t_\\text{pre} < \\min(\\mathrm{g}, t_\\text{eval})$, including longer parallel trend assumptions.\n",
"This can result in multiple estimates for the same $ATT(\\mathrm{g},t)$, which have slightly different assumptions (length of parallel trends)."
Expand All @@ -891,6 +891,29 @@
"dml_obj_all.plot_effects()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Universal Base Period\n",
"\n",
"The option `gt_combinations=\"universal\"` set $t_\\text{pre} = \\mathrm{g} - \\delta - 1$, corresponding to a universal/constant comparison or base period.\n",
"\n",
"Remark that this implies $t_\\text{pre} > t_\\text{eval}$ for all pre-treatment periods (accounting for anticipation). Therefore these effects do not have the same straightforward interpretation as ATT's."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dml_obj_universal = DoubleMLDIDMulti(dml_data, **(default_args| {\"gt_combinations\": \"universal\"}))\n",
"dml_obj_universal.fit()\n",
"dml_obj_universal.bootstrap(n_rep_boot=5000)\n",
"dml_obj_universal.plot_effects()"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Loading
Loading