forked from pymc-devs/pymc-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new Difference In Differences notebook (pymc-devs#424)
* initial commit of DiD notebook * add most of the modelling and inference content * add the counterfactual inference stuff * god damn pre-commit checks * fix spelling in myst.md * more spelling changes * why is this so difficult? * still?! * fixes to model description * fix typo in code block * remove unused imports + better data plot * data plot just right now * fix typo: region -> reason * addressing feedback * "differences in differences" -> "difference in differences" * add "panel data" to tags * proper use of rng according to style guide * add link to the PR in the authors section * add example, more links, more references to papers * fix missing reference and malformed link * minor changes in explanation of DiD schematic
- Loading branch information
1 parent
b84c42e
commit ba37aaa
Showing
5 changed files
with
1,763 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,257 changes: 1,257 additions & 0 deletions
1,257
examples/causal_inference/difference_in_differences.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
examples/causal_inference/make_DAG_difference_in_differences.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import daft | ||
import matplotlib.pyplot as plt | ||
|
||
plt.rcParams.update({"text.usetex": True}) | ||
|
||
pgm = daft.PGM() | ||
pgm.add_node("treat", "treatment", 0, 0.5, aspect=1.8) | ||
pgm.add_node("y", "outcome", 0, -0.5, aspect=1.5) | ||
pgm.add_node("t", "time", -1, 0, aspect=1.2) | ||
pgm.add_node("g", "group", 1, 0, aspect=1.2) | ||
pgm.add_edge("t", "y") | ||
pgm.add_edge("g", "y") | ||
pgm.add_edge("t", "treat") | ||
pgm.add_edge("g", "treat") | ||
pgm.add_edge("treat", "y") | ||
pgm.render() | ||
pgm.savefig("DAG_difference_in_differences.png", dpi=500) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.