Skip to content

Commit 3340891

Browse files
committed
finish the DID explanation
1 parent 447970b commit 3340891

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

docs/source/quasi_dags.ipynb

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -319,16 +319,19 @@
319319
"cell_type": "markdown",
320320
"metadata": {},
321321
"source": [
322-
"Readers are referred to Chapter 18 of {cite:t}`huntington2021effect` for more discussion on the causal DAG for Difference in Differences studies."
323-
]
324-
},
325-
{
326-
"cell_type": "markdown",
327-
"metadata": {},
328-
"source": [
329-
":::{warning}\n",
330-
"This section is unfinished\n",
331-
":::"
322+
":::{note}\n",
323+
"For our explanation below, we will assume we are dealing with the simplest case of a two-group, two-time period design, the so called \"classical\" 2$\\times$2 difference-in-differences design. \n",
324+
":::\n",
325+
"\n",
326+
"Our goal is to estimate the causal effect of the treatment on the outcome, $Z \\rightarrow Y$, but now we have _two_ backdoor paths:\n",
327+
"1. $Z \\leftarrow \\text{time} \\rightarrow Y$\n",
328+
"2. $Z \\leftarrow \\text{group} \\rightarrow Y$\n",
329+
"\n",
330+
"From a regression point of view, both $time$ and $group$ are binary variables. In this situation, treatment is given to the treatment group ($\\text{group}=1$) at time $\\text{time}=1$.\n",
331+
"\n",
332+
"The causal effect of the treatment upon the outcome is typically estimated by fitting a regression model of the form `y ~ time + group + time:group`. The interaction term `time:group` captures the causal effect of $Z \\rightarrow Y$. \n",
333+
"\n",
334+
"We can note that this interaction term $\\text{time} \\times \\text{group}$ encodes the values of $Z$, which as we said above, is equal to 1 for only the treatment group at time 1. So another way to think about the inclusion of an interaction effect is that we are simply conditioning on all the observed data ($Z$, $\\text{time}$, $\\text{group}$, $Y$) to estimate the causal effect of $Z \\rightarrow Y$."
332335
]
333336
},
334337
{

0 commit comments

Comments
 (0)