Skip to content

Commit e7a3448

Browse files
committed
finish adding references to the example notebooks
1 parent 0630589 commit e7a3448

File tree

7 files changed

+71
-38
lines changed

7 files changed

+71
-38
lines changed

docs/source/notebooks/did_pymc.ipynb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,9 @@
147147
"source": [
148148
"## Run the analysis\n",
149149
"\n",
150-
"<div class=\"alert alert-info\">\n",
151-
"\n",
152-
"Note:\n",
153-
"\n",
150+
":::{note}\n",
154151
"The `random_seed` keyword argument for the PyMC sampler is not neccessary. We use it here so that the results are reproducible.\n",
155-
"\n",
156-
"</div>"
152+
":::"
157153
]
158154
},
159155
{

docs/source/notebooks/did_pymc_banks.ipynb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"This example is in-progress! Further elaboration and explanation will follow soon.\n",
1212
":::\n",
1313
"\n",
14-
"This notebook analyses historic data on banking closures from [Richardson & Troost (2009)](http://masteringmetrics.com/wp-content/uploads/2015/02/Richardson_Troost_2009_JPE.pdf) and used as a case study for a difference in differences analysis in the [Mastering Metrics](http://www.masteringmetrics.com) book. Here, we replicate this analysis, but using Bayesian inference."
14+
"This notebook analyses historic data on banking closures from {cite:t}`richardson2009monetary` and used as a case study for a difference in differences analysis in the excellent book [Mastering Metrics](http://www.masteringmetrics.com) {cite:p}`angrist2014mastering`. Here, we replicate this analysis, but using Bayesian inference."
1515
]
1616
},
1717
{
@@ -45,7 +45,7 @@
4545
"source": [
4646
"## Load data\n",
4747
"\n",
48-
"The raw dataset has a `date` columns which is just some uninterpretable number. All we need for our analysis is the `year` column. We also have columns `bib6`, `bio6`, `bib8`, `bio8`. We know that the `6` and `8` represent the 6th and 8th Federal Reserve districts, respectively. I assume `bib` means \"banks in business\", so I'll discard the `bib*` columns. The data is at daily resolution, but we will convert this to yearly resolution. And from what I can tell from Figure 5.2 of the [Mastering Metrics](http://www.masteringmetrics.com) book, they seem to present the _median_ number of banks open per year. Let's load the data up and do those steps."
48+
"The raw dataset has a `date` columns which is just some uninterpretable number. All we need for our analysis is the `year` column. We also have columns `bib6`, `bio6`, `bib8`, `bio8`. We know that the `6` and `8` represent the 6th and 8th Federal Reserve districts, respectively. I assume `bib` means \"banks in business\", so I'll discard the `bib*` columns. The data is at daily resolution, but we will convert this to yearly resolution. And from what I can tell from Figure 5.2 of the {cite:t}`angrist2014mastering`, they seem to present the _median_ number of banks open per year. Let's load the data up and do those steps."
4949
]
5050
},
5151
{
@@ -166,7 +166,7 @@
166166
"cell_type": "markdown",
167167
"metadata": {},
168168
"source": [
169-
"Let's visualise what we have. This matches up exactly with Figure 5.2 of the [Mastering Metrics](http://www.masteringmetrics.com) book."
169+
"Let's visualise what we have. This matches up exactly with Figure 5.2 of the {cite:t}`angrist2014mastering`."
170170
]
171171
},
172172
{
@@ -628,11 +628,15 @@
628628
]
629629
},
630630
{
631-
"cell_type": "code",
632-
"execution_count": null,
631+
"attachments": {},
632+
"cell_type": "markdown",
633633
"metadata": {},
634-
"outputs": [],
635-
"source": []
634+
"source": [
635+
"## References\n",
636+
":::{bibliography}\n",
637+
":filter: docname in docnames\n",
638+
":::"
639+
]
636640
}
637641
],
638642
"metadata": {

docs/source/notebooks/its_pymc.ipynb

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,9 @@
308308
"source": [
309309
"As well as the model coefficients, we might be interested in the avarage causal impact and average cumulative causal impact.\n",
310310
"\n",
311-
"<div class=\"alert alert-info\">\n",
312-
"\n",
313-
"Note\n",
314-
"\n",
311+
":::{note}\n",
315312
"Better output for the summary statistics are in progress!\n",
316-
"\n",
317-
"</div>"
313+
":::"
318314
]
319315
},
320316
{
@@ -401,13 +397,9 @@
401397
"cell_type": "markdown",
402398
"metadata": {},
403399
"source": [
404-
"<div class=\"alert alert-warning\">\n",
405-
"\n",
406-
"Warning\n",
407-
"\n",
400+
":::{warning}\n",
408401
"Care must be taken with the mean impact statistic. It only makes sense to use this statistic if it looks like the intervention had a lasting (and roughly constant) effect on the outcome variable. If the effect is transient, then clearly there will be a lot of post-intervention period where the impact of the intervention has 'worn off'. If so, then it will be hard to interpret the mean impacts real meaning.\n",
409-
"\n",
410-
"</div>"
402+
":::"
411403
]
412404
},
413405
{

docs/source/notebooks/rd_pymc_drinking.ipynb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"source": [
88
"# Drinking age - Bayesian analysis\n",
99
"\n",
10-
"This example uses the regression discontinuity design to make claims about the causal effects of the minimum legal drinking age (21 in the USA) upon all cause mortality rates. The dataset is from a study by [Carpenter & Dobkin, (2009)](https://www.aeaweb.org/articles?id=10.1257/app.1.1.164)."
10+
"This example uses the regression discontinuity design to make claims about the causal effects of the minimum legal drinking age (21 in the USA) upon all cause mortality rates. The dataset is from a study by {cite:t}`carpenter2009effect`."
1111
]
1212
},
1313
{
@@ -563,11 +563,15 @@
563563
]
564564
},
565565
{
566-
"cell_type": "code",
567-
"execution_count": null,
566+
"attachments": {},
567+
"cell_type": "markdown",
568568
"metadata": {},
569-
"outputs": [],
570-
"source": []
569+
"source": [
570+
"## References\n",
571+
":::{bibliography}\n",
572+
":filter: docname in docnames\n",
573+
":::"
574+
]
571575
}
572576
],
573577
"metadata": {

docs/source/notebooks/rd_skl_drinking.ipynb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
{
22
"cells": [
33
{
4+
"attachments": {},
45
"cell_type": "markdown",
56
"metadata": {},
67
"source": [
78
"# Drinking age with a scikit-learn model\n",
89
"\n",
9-
"Run the 'drinking example' from the RDD chapter of [Causal Inference for the Brave and True](https://matheusfacure.github.io/python-causality-handbook/16-Regression-Discontinuity-Design.html).\n",
10-
"\n",
11-
"Use sci-kit learn models"
10+
"This example uses the regression discontinuity design to make claims about the causal effects of the minimum legal drinking age (21 in the USA) upon all cause mortality rates. The dataset is from a study by {cite:t}`carpenter2009effect`."
1211
]
1312
},
1413
{
@@ -52,6 +51,7 @@
5251
]
5352
},
5453
{
54+
"attachments": {},
5555
"cell_type": "markdown",
5656
"metadata": {},
5757
"source": [
@@ -104,6 +104,17 @@
104104
"source": [
105105
"result.summary()"
106106
]
107+
},
108+
{
109+
"attachments": {},
110+
"cell_type": "markdown",
111+
"metadata": {},
112+
"source": [
113+
"## References\n",
114+
":::{bibliography}\n",
115+
":filter: docname in docnames\n",
116+
":::"
117+
]
107118
}
108119
],
109120
"metadata": {

docs/source/notebooks/sc_pymc.ipynb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,10 @@
284284
"cell_type": "markdown",
285285
"metadata": {},
286286
"source": [
287-
"<div class=\"alert alert-warning\">\n",
288-
"\n",
289-
"Warning\n",
287+
":::{Warning}\n",
290288
"\n",
291289
"Care must be taken with the mean impact statistic. It only makes sense to use this statistic if it looks like the intervention had a lasting (and roughly constant) effect on the outcome variable. If the effect is transient, then clearly there will be a lot of post-intervention period where the impact of the intervention has 'worn off'. If so, then it will be hard to interpret the mean impacts real meaning.\n",
292-
"\n",
293-
"</div>"
290+
":::"
294291
]
295292
},
296293
{

docs/source/references.bib

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,32 @@ @book{reichardt2019quasi
1111
year={2019},
1212
publisher={Guilford Publications}
1313
}
14+
15+
@article{richardson2009monetary,
16+
title={Monetary intervention mitigated banking panics during the great depression: quasi-experimental evidence from a federal reserve district border, 1929--1933},
17+
author={Richardson, Gary and Troost, William},
18+
journal={Journal of Political Economy},
19+
volume={117},
20+
number={6},
21+
pages={1031--1073},
22+
year={2009},
23+
publisher={The University of Chicago Press}
24+
}
25+
26+
@book{angrist2014mastering,
27+
title={Mastering 'Metrics: The path from cause to effect},
28+
author={Angrist, Joshua D and Pischke, J{\"o}rn-Steffen},
29+
year={2014},
30+
publisher={Princeton University Press}
31+
}
32+
33+
@article{carpenter2009effect,
34+
title={The effect of alcohol consumption on mortality: regression discontinuity evidence from the minimum drinking age},
35+
author={Carpenter, Christopher and Dobkin, Carlos},
36+
journal={American Economic Journal: Applied Economics},
37+
volume={1},
38+
number={1},
39+
pages={164--182},
40+
year={2009},
41+
publisher={American Economic Association}
42+
}

0 commit comments

Comments
 (0)