CausalPy 0.7.0__tar.gz → 0.8.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {causalpy-0.7.0 → causalpy-0.8.1}/CausalPy.egg-info/PKG-INFO +22 -5
- {causalpy-0.7.0 → causalpy-0.8.1}/CausalPy.egg-info/SOURCES.txt +7 -1
- {causalpy-0.7.0 → causalpy-0.8.1}/CausalPy.egg-info/requires.txt +6 -3
- {causalpy-0.7.0 → causalpy-0.8.1}/CausalPy.egg-info/top_level.txt +1 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/PKG-INFO +22 -5
- {causalpy-0.7.0 → causalpy-0.8.1}/README.md +14 -1
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/__init__.py +9 -1
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/custom_exceptions.py +3 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/datasets.py +4 -0
- causalpy-0.8.1/causalpy/data/geolift1.csv +209 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/simulate_data.py +222 -32
- causalpy-0.8.1/causalpy/data/zipcodes_data.csv +12201 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/experiments/__init__.py +3 -1
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/experiments/base.py +36 -18
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/experiments/diff_in_diff.py +16 -10
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/experiments/instrumental_variable.py +23 -11
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/experiments/interrupted_time_series.py +60 -21
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/experiments/inverse_propensity_weighting.py +14 -6
- causalpy-0.8.1/causalpy/experiments/piecewise_its.py +838 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/experiments/prepostnegd.py +13 -5
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/experiments/regression_discontinuity.py +138 -36
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/experiments/regression_kink.py +37 -7
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/experiments/staggered_did.py +26 -7
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/experiments/synthetic_control.py +202 -57
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/pymc_models.py +5 -5
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/reporting.py +392 -175
- causalpy-0.8.1/causalpy/transforms.py +245 -0
- causalpy-0.8.1/causalpy/utils.py +446 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/variable_selection_priors.py +2 -2
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/version.py +1 -1
- {causalpy-0.7.0 → causalpy-0.8.1}/pyproject.toml +11 -7
- causalpy-0.8.1/scripts/run_notebooks/injected.py +58 -0
- causalpy-0.8.1/scripts/run_notebooks/runner.py +204 -0
- causalpy-0.8.1/scripts/validate_notebooks.py +126 -0
- causalpy-0.7.0/causalpy/data/geolift1.csv +0 -209
- causalpy-0.7.0/causalpy/utils.py +0 -214
- {causalpy-0.7.0 → causalpy-0.8.1}/CausalPy.egg-info/dependency_links.txt +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/LICENSE +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/AJR2001.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/GDP_in_dollars_billions.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/PISA18sampleScale.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/__init__.py +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/ancova_generated.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/banks.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/data_nevo.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/deaths_and_temps_england_wales.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/did.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/drinking.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/geolift_multi_cell.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/gt_social_media_data.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/its.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/its_simple.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/lalonde.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/nets_df.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/nhefs.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/regression_discontinuity.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/schoolingReturns.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/data/synthetic_control.csv +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/date_utils.py +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/plot_utils.py +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/causalpy/skl_models.py +0 -0
- {causalpy-0.7.0 → causalpy-0.8.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: CausalPy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.1
|
|
4
4
|
Summary: Causal inference for quasi-experiments in Python
|
|
5
5
|
Author-email: Ben Vincent <ben.vincent@pymc-labs.com>
|
|
6
6
|
License: Apache License
|
|
@@ -219,6 +219,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
219
219
|
Classifier: Programming Language :: Python :: 3.11
|
|
220
220
|
Classifier: Programming Language :: Python :: 3.12
|
|
221
221
|
Classifier: Programming Language :: Python :: 3.13
|
|
222
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
222
223
|
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
223
224
|
Requires-Python: >=3.11
|
|
224
225
|
Description-Content-Type: text/markdown
|
|
@@ -227,11 +228,11 @@ Requires-Dist: arviz>=0.14.0
|
|
|
227
228
|
Requires-Dist: graphviz
|
|
228
229
|
Requires-Dist: ipython!=8.7.0
|
|
229
230
|
Requires-Dist: matplotlib>=3.5.3
|
|
230
|
-
Requires-Dist: numpy
|
|
231
|
+
Requires-Dist: numpy<2.4
|
|
231
232
|
Requires-Dist: pandas
|
|
232
233
|
Requires-Dist: patsy
|
|
233
|
-
Requires-Dist: pymc
|
|
234
|
-
Requires-Dist:
|
|
234
|
+
Requires-Dist: pymc<6,>=5.15.1
|
|
235
|
+
Requires-Dist: pytensor<3,>=2.38.1
|
|
235
236
|
Requires-Dist: scikit-learn>=1
|
|
236
237
|
Requires-Dist: scipy
|
|
237
238
|
Requires-Dist: seaborn>=0.11.2
|
|
@@ -247,6 +248,7 @@ Requires-Dist: nbformat; extra == "dev"
|
|
|
247
248
|
Requires-Dist: nbconvert; extra == "dev"
|
|
248
249
|
Provides-Extra: docs
|
|
249
250
|
Requires-Dist: ipykernel; extra == "docs"
|
|
251
|
+
Requires-Dist: pymc-marketing>=0.13.1; extra == "docs"
|
|
250
252
|
Requires-Dist: daft-pgm; extra == "docs"
|
|
251
253
|
Requires-Dist: linkify-it-py; extra == "docs"
|
|
252
254
|
Requires-Dist: myst-nb<=1.0.0; extra == "docs"
|
|
@@ -258,6 +260,7 @@ Requires-Dist: sphinx_autodoc_defaultargs; extra == "docs"
|
|
|
258
260
|
Requires-Dist: labs-sphinx-theme; extra == "docs"
|
|
259
261
|
Requires-Dist: sphinx-copybutton; extra == "docs"
|
|
260
262
|
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
|
263
|
+
Requires-Dist: sphinx-sitemap; extra == "docs"
|
|
261
264
|
Requires-Dist: statsmodels; extra == "docs"
|
|
262
265
|
Requires-Dist: sphinxcontrib-bibtex; extra == "docs"
|
|
263
266
|
Requires-Dist: sphinx-notfound-page; extra == "docs"
|
|
@@ -275,6 +278,7 @@ Requires-Dist: pytest-cov; extra == "test"
|
|
|
275
278
|
Requires-Dist: codespell; extra == "test"
|
|
276
279
|
Requires-Dist: nbformat; extra == "test"
|
|
277
280
|
Requires-Dist: nbconvert; extra == "test"
|
|
281
|
+
Requires-Dist: papermill; extra == "test"
|
|
278
282
|
Dynamic: license-file
|
|
279
283
|
|
|
280
284
|
<div align="center">
|
|
@@ -289,7 +293,7 @@ Dynamic: license-file
|
|
|
289
293
|

|
|
290
294
|

|
|
291
295
|

|
|
292
|
-

|
|
293
297
|
[](https://codecov.io/gh/pymc-labs/CausalPy)
|
|
294
298
|
|
|
295
299
|
# CausalPy
|
|
@@ -303,6 +307,8 @@ To get the latest release:
|
|
|
303
307
|
pip install CausalPy
|
|
304
308
|
```
|
|
305
309
|
|
|
310
|
+
If you run into installation issues with PyMC (e.g. BLAS or compilation), try the conda install: `conda install -c conda-forge causalpy`.
|
|
311
|
+
|
|
306
312
|
Alternatively, if you want the very latest version of the package you can install from GitHub:
|
|
307
313
|
|
|
308
314
|
```bash
|
|
@@ -358,6 +364,7 @@ CausalPy has a broad range of quasi-experimental methods for causal inference:
|
|
|
358
364
|
| Geographical lift | Measures the impact of an intervention in a specific geographic area by comparing it to similar areas without the intervention. Commonly used in marketing to assess regional campaigns. |
|
|
359
365
|
| ANCOVA | Analysis of Covariance combines ANOVA and regression to control for the effects of one or more quantitative covariates. Used when comparing group means while controlling for other variables. |
|
|
360
366
|
| Differences in Differences | Compares the changes in outcomes over time between a treatment group and a control group. Used in observational studies to estimate causal effects by accounting for time trends. |
|
|
367
|
+
| Staggered Difference-in-Differences | Estimates event-time treatment effects when different units adopt treatment at different times, using an imputation approach that models untreated outcomes and compares observed outcomes to counterfactual predictions. |
|
|
361
368
|
| Regression discontinuity | Identifies causal effects by exploiting a cutoff or threshold in an assignment variable. Used when treatment is assigned based on a threshold value of an observed variable, allowing comparison just above and below the cutoff. |
|
|
362
369
|
| Regression kink designs | Focuses on changes in the slope (kinks) of the relationship between variables rather than jumps at cutoff points. Used to identify causal effects when treatment intensity changes at a threshold. |
|
|
363
370
|
| Interrupted time series | Analyzes the effect of an intervention by comparing time series data before and after the intervention. Used when data is collected over time and an intervention occurs at a known point, allowing assessment of changes in level or trend. |
|
|
@@ -370,6 +377,16 @@ CausalPy has a broad range of quasi-experimental methods for causal inference:
|
|
|
370
377
|
|
|
371
378
|
---
|
|
372
379
|
|
|
380
|
+
## Getting Help
|
|
381
|
+
|
|
382
|
+
Have questions about using CausalPy? We're here to help!
|
|
383
|
+
|
|
384
|
+
- **Questions & Help**: Visit our [GitHub Discussions Q&A](https://github.com/pymc-labs/CausalPy/discussions/categories/q-a) to ask questions and get help from the community
|
|
385
|
+
- **Bug Reports & Feature Requests**: Open an [Issue](https://github.com/pymc-labs/CausalPy/issues) for bugs or feature requests
|
|
386
|
+
- **Documentation**: Check out our [documentation](https://causalpy.readthedocs.io) for detailed guides and examples
|
|
387
|
+
|
|
388
|
+
Please use GitHub Discussions for general questions rather than opening issues, so we can keep the issue tracker focused on bugs and enhancements.
|
|
389
|
+
|
|
373
390
|
## Support
|
|
374
391
|
|
|
375
392
|
<img src="https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/pymc-labs-log.png" align="right" width="50%" />
|
|
@@ -13,6 +13,7 @@ causalpy/plot_utils.py
|
|
|
13
13
|
causalpy/pymc_models.py
|
|
14
14
|
causalpy/reporting.py
|
|
15
15
|
causalpy/skl_models.py
|
|
16
|
+
causalpy/transforms.py
|
|
16
17
|
causalpy/utils.py
|
|
17
18
|
causalpy/variable_selection_priors.py
|
|
18
19
|
causalpy/version.py
|
|
@@ -39,14 +40,19 @@ causalpy/data/regression_discontinuity.csv
|
|
|
39
40
|
causalpy/data/schoolingReturns.csv
|
|
40
41
|
causalpy/data/simulate_data.py
|
|
41
42
|
causalpy/data/synthetic_control.csv
|
|
43
|
+
causalpy/data/zipcodes_data.csv
|
|
42
44
|
causalpy/experiments/__init__.py
|
|
43
45
|
causalpy/experiments/base.py
|
|
44
46
|
causalpy/experiments/diff_in_diff.py
|
|
45
47
|
causalpy/experiments/instrumental_variable.py
|
|
46
48
|
causalpy/experiments/interrupted_time_series.py
|
|
47
49
|
causalpy/experiments/inverse_propensity_weighting.py
|
|
50
|
+
causalpy/experiments/piecewise_its.py
|
|
48
51
|
causalpy/experiments/prepostnegd.py
|
|
49
52
|
causalpy/experiments/regression_discontinuity.py
|
|
50
53
|
causalpy/experiments/regression_kink.py
|
|
51
54
|
causalpy/experiments/staggered_did.py
|
|
52
|
-
causalpy/experiments/synthetic_control.py
|
|
55
|
+
causalpy/experiments/synthetic_control.py
|
|
56
|
+
scripts/validate_notebooks.py
|
|
57
|
+
scripts/run_notebooks/injected.py
|
|
58
|
+
scripts/run_notebooks/runner.py
|
|
@@ -2,11 +2,11 @@ arviz>=0.14.0
|
|
|
2
2
|
graphviz
|
|
3
3
|
ipython!=8.7.0
|
|
4
4
|
matplotlib>=3.5.3
|
|
5
|
-
numpy
|
|
5
|
+
numpy<2.4
|
|
6
6
|
pandas
|
|
7
7
|
patsy
|
|
8
|
-
pymc
|
|
9
|
-
|
|
8
|
+
pymc<6,>=5.15.1
|
|
9
|
+
pytensor<3,>=2.38.1
|
|
10
10
|
scikit-learn>=1
|
|
11
11
|
scipy
|
|
12
12
|
seaborn>=0.11.2
|
|
@@ -24,6 +24,7 @@ nbconvert
|
|
|
24
24
|
|
|
25
25
|
[docs]
|
|
26
26
|
ipykernel
|
|
27
|
+
pymc-marketing>=0.13.1
|
|
27
28
|
daft-pgm
|
|
28
29
|
linkify-it-py
|
|
29
30
|
myst-nb<=1.0.0
|
|
@@ -35,6 +36,7 @@ sphinx_autodoc_defaultargs
|
|
|
35
36
|
labs-sphinx-theme
|
|
36
37
|
sphinx-copybutton
|
|
37
38
|
sphinx-rtd-theme
|
|
39
|
+
sphinx-sitemap
|
|
38
40
|
statsmodels
|
|
39
41
|
sphinxcontrib-bibtex
|
|
40
42
|
sphinx-notfound-page
|
|
@@ -54,3 +56,4 @@ pytest-cov
|
|
|
54
56
|
codespell
|
|
55
57
|
nbformat
|
|
56
58
|
nbconvert
|
|
59
|
+
papermill
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: CausalPy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.1
|
|
4
4
|
Summary: Causal inference for quasi-experiments in Python
|
|
5
5
|
Author-email: Ben Vincent <ben.vincent@pymc-labs.com>
|
|
6
6
|
License: Apache License
|
|
@@ -219,6 +219,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
219
219
|
Classifier: Programming Language :: Python :: 3.11
|
|
220
220
|
Classifier: Programming Language :: Python :: 3.12
|
|
221
221
|
Classifier: Programming Language :: Python :: 3.13
|
|
222
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
222
223
|
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
223
224
|
Requires-Python: >=3.11
|
|
224
225
|
Description-Content-Type: text/markdown
|
|
@@ -227,11 +228,11 @@ Requires-Dist: arviz>=0.14.0
|
|
|
227
228
|
Requires-Dist: graphviz
|
|
228
229
|
Requires-Dist: ipython!=8.7.0
|
|
229
230
|
Requires-Dist: matplotlib>=3.5.3
|
|
230
|
-
Requires-Dist: numpy
|
|
231
|
+
Requires-Dist: numpy<2.4
|
|
231
232
|
Requires-Dist: pandas
|
|
232
233
|
Requires-Dist: patsy
|
|
233
|
-
Requires-Dist: pymc
|
|
234
|
-
Requires-Dist:
|
|
234
|
+
Requires-Dist: pymc<6,>=5.15.1
|
|
235
|
+
Requires-Dist: pytensor<3,>=2.38.1
|
|
235
236
|
Requires-Dist: scikit-learn>=1
|
|
236
237
|
Requires-Dist: scipy
|
|
237
238
|
Requires-Dist: seaborn>=0.11.2
|
|
@@ -247,6 +248,7 @@ Requires-Dist: nbformat; extra == "dev"
|
|
|
247
248
|
Requires-Dist: nbconvert; extra == "dev"
|
|
248
249
|
Provides-Extra: docs
|
|
249
250
|
Requires-Dist: ipykernel; extra == "docs"
|
|
251
|
+
Requires-Dist: pymc-marketing>=0.13.1; extra == "docs"
|
|
250
252
|
Requires-Dist: daft-pgm; extra == "docs"
|
|
251
253
|
Requires-Dist: linkify-it-py; extra == "docs"
|
|
252
254
|
Requires-Dist: myst-nb<=1.0.0; extra == "docs"
|
|
@@ -258,6 +260,7 @@ Requires-Dist: sphinx_autodoc_defaultargs; extra == "docs"
|
|
|
258
260
|
Requires-Dist: labs-sphinx-theme; extra == "docs"
|
|
259
261
|
Requires-Dist: sphinx-copybutton; extra == "docs"
|
|
260
262
|
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
|
263
|
+
Requires-Dist: sphinx-sitemap; extra == "docs"
|
|
261
264
|
Requires-Dist: statsmodels; extra == "docs"
|
|
262
265
|
Requires-Dist: sphinxcontrib-bibtex; extra == "docs"
|
|
263
266
|
Requires-Dist: sphinx-notfound-page; extra == "docs"
|
|
@@ -275,6 +278,7 @@ Requires-Dist: pytest-cov; extra == "test"
|
|
|
275
278
|
Requires-Dist: codespell; extra == "test"
|
|
276
279
|
Requires-Dist: nbformat; extra == "test"
|
|
277
280
|
Requires-Dist: nbconvert; extra == "test"
|
|
281
|
+
Requires-Dist: papermill; extra == "test"
|
|
278
282
|
Dynamic: license-file
|
|
279
283
|
|
|
280
284
|
<div align="center">
|
|
@@ -289,7 +293,7 @@ Dynamic: license-file
|
|
|
289
293
|

|
|
290
294
|

|
|
291
295
|

|
|
292
|
-

|
|
293
297
|
[](https://codecov.io/gh/pymc-labs/CausalPy)
|
|
294
298
|
|
|
295
299
|
# CausalPy
|
|
@@ -303,6 +307,8 @@ To get the latest release:
|
|
|
303
307
|
pip install CausalPy
|
|
304
308
|
```
|
|
305
309
|
|
|
310
|
+
If you run into installation issues with PyMC (e.g. BLAS or compilation), try the conda install: `conda install -c conda-forge causalpy`.
|
|
311
|
+
|
|
306
312
|
Alternatively, if you want the very latest version of the package you can install from GitHub:
|
|
307
313
|
|
|
308
314
|
```bash
|
|
@@ -358,6 +364,7 @@ CausalPy has a broad range of quasi-experimental methods for causal inference:
|
|
|
358
364
|
| Geographical lift | Measures the impact of an intervention in a specific geographic area by comparing it to similar areas without the intervention. Commonly used in marketing to assess regional campaigns. |
|
|
359
365
|
| ANCOVA | Analysis of Covariance combines ANOVA and regression to control for the effects of one or more quantitative covariates. Used when comparing group means while controlling for other variables. |
|
|
360
366
|
| Differences in Differences | Compares the changes in outcomes over time between a treatment group and a control group. Used in observational studies to estimate causal effects by accounting for time trends. |
|
|
367
|
+
| Staggered Difference-in-Differences | Estimates event-time treatment effects when different units adopt treatment at different times, using an imputation approach that models untreated outcomes and compares observed outcomes to counterfactual predictions. |
|
|
361
368
|
| Regression discontinuity | Identifies causal effects by exploiting a cutoff or threshold in an assignment variable. Used when treatment is assigned based on a threshold value of an observed variable, allowing comparison just above and below the cutoff. |
|
|
362
369
|
| Regression kink designs | Focuses on changes in the slope (kinks) of the relationship between variables rather than jumps at cutoff points. Used to identify causal effects when treatment intensity changes at a threshold. |
|
|
363
370
|
| Interrupted time series | Analyzes the effect of an intervention by comparing time series data before and after the intervention. Used when data is collected over time and an intervention occurs at a known point, allowing assessment of changes in level or trend. |
|
|
@@ -370,6 +377,16 @@ CausalPy has a broad range of quasi-experimental methods for causal inference:
|
|
|
370
377
|
|
|
371
378
|
---
|
|
372
379
|
|
|
380
|
+
## Getting Help
|
|
381
|
+
|
|
382
|
+
Have questions about using CausalPy? We're here to help!
|
|
383
|
+
|
|
384
|
+
- **Questions & Help**: Visit our [GitHub Discussions Q&A](https://github.com/pymc-labs/CausalPy/discussions/categories/q-a) to ask questions and get help from the community
|
|
385
|
+
- **Bug Reports & Feature Requests**: Open an [Issue](https://github.com/pymc-labs/CausalPy/issues) for bugs or feature requests
|
|
386
|
+
- **Documentation**: Check out our [documentation](https://causalpy.readthedocs.io) for detailed guides and examples
|
|
387
|
+
|
|
388
|
+
Please use GitHub Discussions for general questions rather than opening issues, so we can keep the issue tracker focused on bugs and enhancements.
|
|
389
|
+
|
|
373
390
|
## Support
|
|
374
391
|
|
|
375
392
|
<img src="https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/pymc-labs-log.png" align="right" width="50%" />
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|

|
|
11
11
|

|
|
12
12
|

|
|
13
|
-

|
|
14
14
|
[](https://codecov.io/gh/pymc-labs/CausalPy)
|
|
15
15
|
|
|
16
16
|
# CausalPy
|
|
@@ -24,6 +24,8 @@ To get the latest release:
|
|
|
24
24
|
pip install CausalPy
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
If you run into installation issues with PyMC (e.g. BLAS or compilation), try the conda install: `conda install -c conda-forge causalpy`.
|
|
28
|
+
|
|
27
29
|
Alternatively, if you want the very latest version of the package you can install from GitHub:
|
|
28
30
|
|
|
29
31
|
```bash
|
|
@@ -79,6 +81,7 @@ CausalPy has a broad range of quasi-experimental methods for causal inference:
|
|
|
79
81
|
| Geographical lift | Measures the impact of an intervention in a specific geographic area by comparing it to similar areas without the intervention. Commonly used in marketing to assess regional campaigns. |
|
|
80
82
|
| ANCOVA | Analysis of Covariance combines ANOVA and regression to control for the effects of one or more quantitative covariates. Used when comparing group means while controlling for other variables. |
|
|
81
83
|
| Differences in Differences | Compares the changes in outcomes over time between a treatment group and a control group. Used in observational studies to estimate causal effects by accounting for time trends. |
|
|
84
|
+
| Staggered Difference-in-Differences | Estimates event-time treatment effects when different units adopt treatment at different times, using an imputation approach that models untreated outcomes and compares observed outcomes to counterfactual predictions. |
|
|
82
85
|
| Regression discontinuity | Identifies causal effects by exploiting a cutoff or threshold in an assignment variable. Used when treatment is assigned based on a threshold value of an observed variable, allowing comparison just above and below the cutoff. |
|
|
83
86
|
| Regression kink designs | Focuses on changes in the slope (kinks) of the relationship between variables rather than jumps at cutoff points. Used to identify causal effects when treatment intensity changes at a threshold. |
|
|
84
87
|
| Interrupted time series | Analyzes the effect of an intervention by comparing time series data before and after the intervention. Used when data is collected over time and an intervention occurs at a known point, allowing assessment of changes in level or trend. |
|
|
@@ -91,6 +94,16 @@ CausalPy has a broad range of quasi-experimental methods for causal inference:
|
|
|
91
94
|
|
|
92
95
|
---
|
|
93
96
|
|
|
97
|
+
## Getting Help
|
|
98
|
+
|
|
99
|
+
Have questions about using CausalPy? We're here to help!
|
|
100
|
+
|
|
101
|
+
- **Questions & Help**: Visit our [GitHub Discussions Q&A](https://github.com/pymc-labs/CausalPy/discussions/categories/q-a) to ask questions and get help from the community
|
|
102
|
+
- **Bug Reports & Feature Requests**: Open an [Issue](https://github.com/pymc-labs/CausalPy/issues) for bugs or feature requests
|
|
103
|
+
- **Documentation**: Check out our [documentation](https://causalpy.readthedocs.io) for detailed guides and examples
|
|
104
|
+
|
|
105
|
+
Please use GitHub Discussions for general questions rather than opening issues, so we can keep the issue tracker focused on bugs and enhancements.
|
|
106
|
+
|
|
94
107
|
## Support
|
|
95
108
|
|
|
96
109
|
<img src="https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/pymc-labs-log.png" align="right" width="50%" />
|
|
@@ -16,6 +16,7 @@ import causalpy.pymc_models as pymc_models
|
|
|
16
16
|
import causalpy.skl_models as skl_models
|
|
17
17
|
import causalpy.variable_selection_priors as variable_selection_priors
|
|
18
18
|
from causalpy.skl_models import create_causalpy_compatible_class
|
|
19
|
+
from causalpy.transforms import ramp, step
|
|
19
20
|
from causalpy.version import __version__
|
|
20
21
|
|
|
21
22
|
from .data import load_data
|
|
@@ -23,26 +24,33 @@ from .experiments.diff_in_diff import DifferenceInDifferences
|
|
|
23
24
|
from .experiments.instrumental_variable import InstrumentalVariable
|
|
24
25
|
from .experiments.interrupted_time_series import InterruptedTimeSeries
|
|
25
26
|
from .experiments.inverse_propensity_weighting import InversePropensityWeighting
|
|
27
|
+
from .experiments.piecewise_its import PiecewiseITS
|
|
26
28
|
from .experiments.prepostnegd import PrePostNEGD
|
|
27
29
|
from .experiments.regression_discontinuity import RegressionDiscontinuity
|
|
28
30
|
from .experiments.regression_kink import RegressionKink
|
|
29
31
|
from .experiments.staggered_did import StaggeredDifferenceInDifferences
|
|
30
32
|
from .experiments.synthetic_control import SyntheticControl
|
|
33
|
+
from .utils import extract_lift_for_mmm, plot_correlations
|
|
31
34
|
|
|
32
35
|
__all__ = [
|
|
33
36
|
"__version__",
|
|
34
|
-
"DifferenceInDifferences",
|
|
35
37
|
"create_causalpy_compatible_class",
|
|
38
|
+
"DifferenceInDifferences",
|
|
39
|
+
"extract_lift_for_mmm",
|
|
40
|
+
"plot_correlations",
|
|
36
41
|
"InstrumentalVariable",
|
|
37
42
|
"InterruptedTimeSeries",
|
|
38
43
|
"InversePropensityWeighting",
|
|
39
44
|
"load_data",
|
|
45
|
+
"PiecewiseITS",
|
|
40
46
|
"PrePostNEGD",
|
|
41
47
|
"pymc_models",
|
|
48
|
+
"ramp",
|
|
42
49
|
"RegressionDiscontinuity",
|
|
43
50
|
"RegressionKink",
|
|
44
51
|
"skl_models",
|
|
45
52
|
"StaggeredDifferenceInDifferences",
|
|
53
|
+
"step",
|
|
46
54
|
"SyntheticControl",
|
|
47
55
|
"variable_selection_priors",
|
|
48
56
|
]
|
|
@@ -21,6 +21,7 @@ class BadIndexException(Exception):
|
|
|
21
21
|
index and an event, typically a treatment or intervention."""
|
|
22
22
|
|
|
23
23
|
def __init__(self, message: str):
|
|
24
|
+
super().__init__(message)
|
|
24
25
|
self.message = message
|
|
25
26
|
|
|
26
27
|
|
|
@@ -29,6 +30,7 @@ class FormulaException(Exception):
|
|
|
29
30
|
formula"""
|
|
30
31
|
|
|
31
32
|
def __init__(self, message: str):
|
|
33
|
+
super().__init__(message)
|
|
32
34
|
self.message = message
|
|
33
35
|
|
|
34
36
|
|
|
@@ -36,4 +38,5 @@ class DataException(Exception):
|
|
|
36
38
|
"""Exception raised given when there is some error in user-provided dataframe"""
|
|
37
39
|
|
|
38
40
|
def __init__(self, message: str):
|
|
41
|
+
super().__init__(message)
|
|
39
42
|
self.message = message
|
|
@@ -40,6 +40,7 @@ DATASETS = {
|
|
|
40
40
|
"pisa18": {"filename": "PISA18sampleScale.csv"},
|
|
41
41
|
"nets": {"filename": "nets_df.csv"},
|
|
42
42
|
"lalonde": {"filename": "lalonde.csv"},
|
|
43
|
+
"zipcodes": {"filename": "zipcodes_data.csv"},
|
|
43
44
|
"nevo": {"filename": "data_nevo.csv"},
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -80,6 +81,9 @@ def load_data(dataset: str) -> pd.DataFrame:
|
|
|
80
81
|
- ``"pisa18"`` - PISA 2018 sample data
|
|
81
82
|
- ``"nets"`` - National Supported Work Demonstration dataset
|
|
82
83
|
- ``"lalonde"`` - LaLonde dataset for propensity score analysis
|
|
84
|
+
- ``"zipcodes"`` - Geo-experimentation zipcode data for comparative interrupted time
|
|
85
|
+
series analysis. Based on synthetic data from Juan Orduz's blog post on
|
|
86
|
+
`time-based regression for geo-experiments <https://juanitorduz.github.io/time_based_regression_pymc/>`_.
|
|
83
87
|
|
|
84
88
|
Returns
|
|
85
89
|
-------
|