Skip to content

Commit e94f3ca

Browse files
committed
Merge branch 'main' into round_to
2 parents 09ae428 + 83cb28c commit e94f3ca

File tree

6 files changed

+22
-21
lines changed

6 files changed

+22
-21
lines changed

Makefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ init:
55

66
lint:
77
pip install causalpy[lint]
8-
isort .
9-
black .
8+
ruff check --fix .
9+
ruff format .
1010

1111
check_lint:
1212
pip install causalpy[lint]
13-
flake8 .
14-
isort --check-only .
15-
black --diff --check --fast .
13+
ruff check .
14+
ruff format --diff --check .
1615
nbqa black --check .
17-
nbqa isort --check-only .
16+
nbqa ruff .
1817
interrogate .
1918

2019
doctest:

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div align="center">
2-
<a href="https://github.com/pymc-labs/CausalPy"><img width="60%" src="docs/source/_static/logo.png"></a>
2+
<a href="https://github.com/pymc-labs/CausalPy"><img width="60%" src="https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/logo.png"></a>
33
</div>
44

55
----
@@ -82,7 +82,7 @@ This is appropriate when you have multiple units, one of which is treated. You b
8282

8383
| Frequentist | Bayesian |
8484
|--|--|
85-
| ![](docs/source/_static/synthetic_control_skl.svg) | ![](docs/source/_static/synthetic_control_pymc.svg) |
85+
| ![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/synthetic_control_skl.svg) | ![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/synthetic_control_pymc.svg) |
8686

8787
> The data (treated and untreated units), pre-treatment model fit, and counterfactual (i.e. the synthetic control) are plotted (top). The causal impact is shown as a blue shaded region. The Bayesian analysis shows shaded Bayesian credible regions of the model fit and counterfactual. Also shown is the causal impact (middle) and cumulative causal impact (bottom).
8888
@@ -121,7 +121,7 @@ Data is expected to be in the following form. Shown are just two units - one in
121121

122122
| Frequentist | Bayesian |
123123
|--|--|
124-
| ![](docs/source/_static/difference_in_differences_skl.svg) | ![](docs/source/_static/difference_in_differences_pymc.svg) |
124+
| ![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/difference_in_differences_skl.svg) | ![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/difference_in_differences_pymc.svg) |
125125

126126
>The data, model fit, and counterfactual are plotted. Frequentist model fits result in points estimates, but the Bayesian analysis results in posterior distributions, represented by the violin plots. The causal impact is the difference between the counterfactual prediction (treated group, post treatment) and the observed values for the treated group, post treatment.
127127
@@ -140,7 +140,7 @@ Regression discontinuity designs are used when treatment is applied to units acc
140140

141141
| Frequentist | Bayesian |
142142
|--|--|
143-
| ![](docs/source/_static/regression_discontinuity_skl.svg) | ![](docs/source/_static/regression_discontinuity_pymc.svg) |
143+
| ![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/regression_discontinuity_skl.svg) | ![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/regression_discontinuity_pymc.svg) |
144144

145145
> The data, model fit, and counterfactual are plotted (top). Frequentist analysis shows the causal impact with the blue shaded region, but this is not shown in the Bayesian analysis to avoid a cluttered chart. Instead, the Bayesian analysis shows shaded Bayesian credible regions of the model fits. The Frequentist analysis visualises the point estimate of the causal impact, but the Bayesian analysis also plots the posterior distribution of the regression discontinuity effect (bottom).
146146
@@ -159,7 +159,7 @@ Regression discontinuity designs are used when treatment is applied to units acc
159159

160160
| Frequentist | Bayesian |
161161
|--|--|
162-
| coming soon | ![](docs/source/_static/regression_kink_pymc.svg) |
162+
| coming soon | ![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/regression_kink_pymc.svg) |
163163

164164
> The data and model fit. The Bayesian analysis shows the posterior mean with credible intervals (shaded regions). We also report the Bayesian $R^2$ on the data along with the posterior mean and credible intervals of the change in gradient at the kink point.
165165
@@ -178,15 +178,15 @@ Interrupted time series analysis is appropriate when you have a time series of o
178178

179179
| Frequentist | Bayesian |
180180
|--|--|
181-
| coming soon | ![](docs/source/_static/interrupted_time_series_pymc.svg) |
181+
| coming soon | ![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/interrupted_time_series_pymc.svg) |
182182

183183
> The data, pre-treatment model fit, and counterfactual are plotted (top). The causal impact is shown as a blue shaded region. The Bayesian analysis shows shaded Bayesian credible regions of the model fit and counterfactual. Also shown is the causal impact (middle) and cumulative causal impact (bottom).
184184
185185
### Instrumental Variable Regression
186186

187187
Instrumental Variable regression is an appropriate technique when you wish to estimate the treatment effect of some variable on another, but are concerned that the treatment variable is endogenous in the system of interest i.e. correlated with the errors. In this case an “instrument” variable can be used in a regression context to disentangle treatment effect due to the threat of confounding due to endogeneity.
188188

189-
![](docs/source/_static/iv_reg1.png)
189+
![](https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/iv_reg1.png)
190190

191191
## Learning resources
192192

@@ -207,7 +207,7 @@ Here are some general resources about causal inference:
207207

208208
## Support
209209

210-
<img src="docs/source/_static/pymc-labs-log.png" align="right" width="50%" />
210+
<img src="https://raw.githubusercontent.com/pymc-labs/CausalPy/main/docs/source/_static/pymc-labs-log.png" align="right" width="50%" />
211211

212212
This repository is supported by [PyMC Labs](https://www.pymc-labs.com).
213213

causalpy/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import arviz as az
22

3-
from causalpy import pymc_experiments
4-
from causalpy import pymc_models
5-
from causalpy import skl_experiments
6-
from causalpy import skl_models
3+
from causalpy import pymc_experiments, pymc_models, skl_experiments, skl_models
74
from causalpy.version import __version__
85

96
from .data import load_data

causalpy/pymc_experiments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
1212
"""
1313

14-
import warnings
14+
import warnings # noqa: I001
1515
from typing import Union
1616

1717
import arviz as az

causalpy/tests/test_input_validation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""Input validation tests"""
22

3-
import numpy as np
3+
import numpy as np # noqa: I001
44
import pandas as pd
55
import pytest
66

77
import causalpy as cp
8-
from causalpy.custom_exceptions import BadIndexException # NOQA
8+
from causalpy.custom_exceptions import BadIndexException
99
from causalpy.custom_exceptions import DataException, FormulaException
1010

1111
sample_kwargs = {"tune": 20, "draws": 20, "chains": 2, "cores": 2}

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,8 @@ color = true
112112
omit-covered-files = false
113113
generate-badge = "docs/source/_static/"
114114
badge-format = "svg"
115+
116+
[tool.ruff.lint]
117+
extend-select = [
118+
"I", # isort
119+
]

0 commit comments

Comments
 (0)