CausalPy 0.2.3__tar.gz → 0.3.0__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.
Files changed (46) hide show
  1. {CausalPy-0.2.3 → causalpy-0.3.0/CausalPy.egg-info}/PKG-INFO +15 -3
  2. {CausalPy-0.2.3 → causalpy-0.3.0}/CausalPy.egg-info/SOURCES.txt +2 -8
  3. {CausalPy-0.2.3 → causalpy-0.3.0}/CausalPy.egg-info/requires.txt +3 -2
  4. {CausalPy-0.2.3/CausalPy.egg-info → causalpy-0.3.0}/PKG-INFO +15 -3
  5. {CausalPy-0.2.3 → causalpy-0.3.0}/README.md +11 -0
  6. causalpy-0.3.0/causalpy/__init__.py +30 -0
  7. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/custom_exceptions.py +13 -0
  8. causalpy-0.3.0/causalpy/data/__init__.py +18 -0
  9. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data/datasets.py +15 -0
  10. causalpy-0.3.0/causalpy/data/nhefs.csv +1567 -0
  11. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data/simulate_data.py +14 -0
  12. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data_validation.py +39 -0
  13. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/plot_utils.py +13 -0
  14. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/pymc_experiments.py +457 -0
  15. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/pymc_models.py +127 -21
  16. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/skl_experiments.py +14 -0
  17. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/skl_models.py +14 -0
  18. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/utils.py +14 -0
  19. causalpy-0.3.0/causalpy/version.py +16 -0
  20. {CausalPy-0.2.3 → causalpy-0.3.0}/pyproject.toml +4 -3
  21. CausalPy-0.2.3/CONTRIBUTING.md +0 -201
  22. CausalPy-0.2.3/causalpy/__init__.py +0 -17
  23. CausalPy-0.2.3/causalpy/data/__init__.py +0 -4
  24. CausalPy-0.2.3/causalpy/tests/__init__.py +0 -0
  25. CausalPy-0.2.3/causalpy/tests/conftest.py +0 -15
  26. CausalPy-0.2.3/causalpy/tests/test_data_loading.py +0 -32
  27. CausalPy-0.2.3/causalpy/tests/test_integration_pymc_examples.py +0 -499
  28. CausalPy-0.2.3/causalpy/tests/test_integration_skl_examples.py +0 -191
  29. CausalPy-0.2.3/causalpy/tests/test_pymc_models.py +0 -164
  30. CausalPy-0.2.3/causalpy/version.py +0 -3
  31. {CausalPy-0.2.3 → causalpy-0.3.0}/CausalPy.egg-info/dependency_links.txt +0 -0
  32. {CausalPy-0.2.3 → causalpy-0.3.0}/CausalPy.egg-info/top_level.txt +0 -0
  33. {CausalPy-0.2.3 → causalpy-0.3.0}/LICENSE +0 -0
  34. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data/AJR2001.csv +0 -0
  35. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data/GDP_in_dollars_billions.csv +0 -0
  36. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data/ancova_generated.csv +0 -0
  37. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data/banks.csv +0 -0
  38. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data/deaths_and_temps_england_wales.csv +0 -0
  39. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data/did.csv +0 -0
  40. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data/drinking.csv +0 -0
  41. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data/geolift1.csv +0 -0
  42. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data/its.csv +0 -0
  43. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data/its_simple.csv +0 -0
  44. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data/regression_discontinuity.csv +0 -0
  45. {CausalPy-0.2.3 → causalpy-0.3.0}/causalpy/data/synthetic_control.csv +0 -0
  46. {CausalPy-0.2.3 → causalpy-0.3.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: CausalPy
3
- Version: 0.2.3
3
+ Version: 0.3.0
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
@@ -218,7 +218,7 @@ Requires-Dist: matplotlib>=3.5.3
218
218
  Requires-Dist: numpy<1.26.0
219
219
  Requires-Dist: pandas
220
220
  Requires-Dist: patsy
221
- Requires-Dist: pymc>=5.0.0
221
+ Requires-Dist: pymc>=5.14.0
222
222
  Requires-Dist: scikit-learn>=1
223
223
  Requires-Dist: scipy
224
224
  Requires-Dist: seaborn>=0.11.2
@@ -231,8 +231,9 @@ Requires-Dist: twine; extra == "dev"
231
231
  Requires-Dist: interrogate; extra == "dev"
232
232
  Provides-Extra: docs
233
233
  Requires-Dist: ipykernel; extra == "docs"
234
+ Requires-Dist: daft; extra == "docs"
234
235
  Requires-Dist: linkify-it-py; extra == "docs"
235
- Requires-Dist: myst-nb; extra == "docs"
236
+ Requires-Dist: myst-nb<=1.0.0; extra == "docs"
236
237
  Requires-Dist: pathlib; extra == "docs"
237
238
  Requires-Dist: sphinx; extra == "docs"
238
239
  Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
@@ -440,6 +441,17 @@ Instrumental Variable regression is an appropriate technique when you wish to es
440
441
 
441
442
  ![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/iv_reg1.png)
442
443
 
444
+
445
+ ### Inverse Propensity Score Weighting
446
+
447
+ Propensity scores are often used to address the risks of bias or confounding introduced in an observational study by
448
+ selection effects into the treatment condition. Propensity scores can be used in a number of ways, but here we demonstrate
449
+ their usage within corrective weighting schemes aimed to recover as-if random allocation of subjects to the treatment condition.
450
+ The technique "up-weights" or "down-weights" individual observations to better estimate a causal estimand such as the average treatment
451
+ effect.
452
+
453
+ ![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/propensity_weight.png)
454
+
443
455
  ## Learning resources
444
456
 
445
457
  Here are some general resources about causal inference:
@@ -1,4 +1,3 @@
1
- CONTRIBUTING.md
2
1
  LICENSE
3
2
  README.md
4
3
  pyproject.toml
@@ -29,12 +28,7 @@ causalpy/data/drinking.csv
29
28
  causalpy/data/geolift1.csv
30
29
  causalpy/data/its.csv
31
30
  causalpy/data/its_simple.csv
31
+ causalpy/data/nhefs.csv
32
32
  causalpy/data/regression_discontinuity.csv
33
33
  causalpy/data/simulate_data.py
34
- causalpy/data/synthetic_control.csv
35
- causalpy/tests/__init__.py
36
- causalpy/tests/conftest.py
37
- causalpy/tests/test_data_loading.py
38
- causalpy/tests/test_integration_pymc_examples.py
39
- causalpy/tests/test_integration_skl_examples.py
40
- causalpy/tests/test_pymc_models.py
34
+ causalpy/data/synthetic_control.csv
@@ -5,7 +5,7 @@ matplotlib>=3.5.3
5
5
  numpy<1.26.0
6
6
  pandas
7
7
  patsy
8
- pymc>=5.0.0
8
+ pymc>=5.14.0
9
9
  scikit-learn>=1
10
10
  scipy
11
11
  seaborn>=0.11.2
@@ -20,8 +20,9 @@ interrogate
20
20
 
21
21
  [docs]
22
22
  ipykernel
23
+ daft
23
24
  linkify-it-py
24
- myst-nb
25
+ myst-nb<=1.0.0
25
26
  pathlib
26
27
  sphinx
27
28
  sphinx-autodoc-typehints
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: CausalPy
3
- Version: 0.2.3
3
+ Version: 0.3.0
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
@@ -218,7 +218,7 @@ Requires-Dist: matplotlib>=3.5.3
218
218
  Requires-Dist: numpy<1.26.0
219
219
  Requires-Dist: pandas
220
220
  Requires-Dist: patsy
221
- Requires-Dist: pymc>=5.0.0
221
+ Requires-Dist: pymc>=5.14.0
222
222
  Requires-Dist: scikit-learn>=1
223
223
  Requires-Dist: scipy
224
224
  Requires-Dist: seaborn>=0.11.2
@@ -231,8 +231,9 @@ Requires-Dist: twine; extra == "dev"
231
231
  Requires-Dist: interrogate; extra == "dev"
232
232
  Provides-Extra: docs
233
233
  Requires-Dist: ipykernel; extra == "docs"
234
+ Requires-Dist: daft; extra == "docs"
234
235
  Requires-Dist: linkify-it-py; extra == "docs"
235
- Requires-Dist: myst-nb; extra == "docs"
236
+ Requires-Dist: myst-nb<=1.0.0; extra == "docs"
236
237
  Requires-Dist: pathlib; extra == "docs"
237
238
  Requires-Dist: sphinx; extra == "docs"
238
239
  Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
@@ -440,6 +441,17 @@ Instrumental Variable regression is an appropriate technique when you wish to es
440
441
 
441
442
  ![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/iv_reg1.png)
442
443
 
444
+
445
+ ### Inverse Propensity Score Weighting
446
+
447
+ Propensity scores are often used to address the risks of bias or confounding introduced in an observational study by
448
+ selection effects into the treatment condition. Propensity scores can be used in a number of ways, but here we demonstrate
449
+ their usage within corrective weighting schemes aimed to recover as-if random allocation of subjects to the treatment condition.
450
+ The technique "up-weights" or "down-weights" individual observations to better estimate a causal estimand such as the average treatment
451
+ effect.
452
+
453
+ ![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/propensity_weight.png)
454
+
443
455
  ## Learning resources
444
456
 
445
457
  Here are some general resources about causal inference:
@@ -188,6 +188,17 @@ Instrumental Variable regression is an appropriate technique when you wish to es
188
188
 
189
189
  ![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/iv_reg1.png)
190
190
 
191
+
192
+ ### Inverse Propensity Score Weighting
193
+
194
+ Propensity scores are often used to address the risks of bias or confounding introduced in an observational study by
195
+ selection effects into the treatment condition. Propensity scores can be used in a number of ways, but here we demonstrate
196
+ their usage within corrective weighting schemes aimed to recover as-if random allocation of subjects to the treatment condition.
197
+ The technique "up-weights" or "down-weights" individual observations to better estimate a causal estimand such as the average treatment
198
+ effect.
199
+
200
+ ![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/propensity_weight.png)
201
+
191
202
  ## Learning resources
192
203
 
193
204
  Here are some general resources about causal inference:
@@ -0,0 +1,30 @@
1
+ # Copyright 2024 The PyMC Labs Developers
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ import arviz as az
15
+
16
+ from causalpy import pymc_experiments, pymc_models, skl_experiments, skl_models
17
+ from causalpy.version import __version__
18
+
19
+ from .data import load_data
20
+
21
+ az.style.use("arviz-darkgrid")
22
+
23
+ __all__ = [
24
+ "pymc_experiments",
25
+ "pymc_models",
26
+ "skl_experiments",
27
+ "skl_models",
28
+ "load_data",
29
+ "__version__",
30
+ ]
@@ -1,3 +1,16 @@
1
+ # Copyright 2024 The PyMC Labs Developers
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
1
14
  """
2
15
  Custom Exceptions for CausalPy.
3
16
  """
@@ -0,0 +1,18 @@
1
+ # Copyright 2024 The PyMC Labs Developers
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Code for loading datasets."""
15
+
16
+ from .datasets import load_data
17
+
18
+ __all__ = ["load_data"]
@@ -1,6 +1,20 @@
1
+ # Copyright 2024 The PyMC Labs Developers
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
1
14
  """
2
15
  Functions to load example datasets
3
16
  """
17
+
4
18
  import pathlib
5
19
 
6
20
  import pandas as pd
@@ -20,6 +34,7 @@ DATASETS = {
20
34
  "anova1": {"filename": "ancova_generated.csv"},
21
35
  "geolift1": {"filename": "geolift1.csv"},
22
36
  "risk": {"filename": "AJR2001.csv"},
37
+ "nhefs": {"filename": "nhefs.csv"},
23
38
  }
24
39
 
25
40