|
52 | 52 | "\n",
|
53 | 53 | "This notebook provides a brief overview of the difference in differences approach to causal inference, and shows a working example of how to conduct this type of analysis under the Bayesian framework, using PyMC. While the notebooks provides a high level overview of the approach, I recommend consulting two excellent textbooks on causal inference. Both [The Effect](https://theeffectbook.net/) {cite:p}`huntington2021effect` and [Causal Inference: The Mixtape](https://mixtape.scunning.com) {cite:p}`cunningham2021causal` have chapters devoted to difference in differences.\n",
|
54 | 54 | "\n",
|
55 |
| - "Difference in differences would be a good approach to take for causal inference if:\n", |
| 55 | + "Difference in differences](https://en.wikipedia.org/wiki/Difference_in_differences) would be a good approach to take for causal inference if:\n", |
56 | 56 | "* you want to know the causal impact of a treatment/intervention\n",
|
57 | 57 | "* you have pre and post treatment measures\n",
|
58 | 58 | "* you have both a treatment and a control group\n",
|
59 |
| - "* the treatment was _not_ allocated by randomisation.\n", |
| 59 | + "* the treatment was _not_ allocated by randomisation, that is, you are in a [quasi-experimental](https://en.wikipedia.org/wiki/Quasi-experiment) setting.\n", |
60 | 60 | "\n",
|
61 | 61 | "Otherwise there are likely better suited approaches you could use.\n",
|
62 | 62 | "\n",
|
63 | 63 | "Note that our desire to estimate the causal impact of a treatment involves [counterfactual thinking](https://en.wikipedia.org/wiki/Counterfactual_thinking). This is because we are asking \"What would the post-treatment outcome of the treatment group be _if_ treatment had not been administered?\" but we can never observe this."
|
64 | 64 | ]
|
65 | 65 | },
|
| 66 | + { |
| 67 | + "cell_type": "markdown", |
| 68 | + "id": "6ec005f3-c443-4243-a4f5-c86252367fe8", |
| 69 | + "metadata": {}, |
| 70 | + "source": [ |
| 71 | + "### Example\n", |
| 72 | + "\n", |
| 73 | + "A classic example is given by a study by {cite:t}`card1993minimum`. This study examined the effects of increasing the minimum wage upon employment in the fast food sector. This is a quasi-experimental setting because the intervention (increase in minimum wages) was not applied to different geographical units (e.g. states) randomly. The intevention was applied to New Jersey in April 1992. If they measured pre and post intervention employment rates in New Jersey only, then they would have failed to control for omitted variables changing over time (e.g. seasonal effects) which could provide alternative causal explanations for changes in employment rates. But by selecting a control state (Pennsylvania), this allows one to infer that changes in employment in Pennsylvania would match the counterfactual - what _would have happened if_ New Jersey had not received the intervention?" |
| 74 | + ] |
| 75 | + }, |
66 | 76 | {
|
67 | 77 | "cell_type": "markdown",
|
68 | 78 | "id": "54f5c8aa-2a4d-4b77-ba64-a0e9df729103",
|
|
1144 | 1154 | "So there we have it, we have a full posterior distribution over our estimated causal impact using the difference in differences approach."
|
1145 | 1155 | ]
|
1146 | 1156 | },
|
| 1157 | + { |
| 1158 | + "cell_type": "markdown", |
| 1159 | + "id": "bf284262-ef3f-4cc1-af07-f20bb3c69ce3", |
| 1160 | + "metadata": {}, |
| 1161 | + "source": [ |
| 1162 | + "## Summary\n", |
| 1163 | + "Of course, when using the difference in differences approach for real applications, there is a lot more due diligence that's needed. Readers are encouraged to check out the textbooks listed above in the introduction as well as a useful review paper {cite:p}`wing2018designing` which covers the important contextual issues in more detail. Additionally, {cite:t}`bertrand2004much` takes a skeptical look at the approach as well as proposing solutions to some of the problems they highlight." |
| 1164 | + ] |
| 1165 | + }, |
1147 | 1166 | {
|
1148 | 1167 | "cell_type": "markdown",
|
1149 | 1168 | "id": "b3b2ee6b-2581-4ee5-a305-b9712dd49f09",
|
|
0 commit comments