Skip to content

Commit a25da0a

Browse files
committed
Merge branch 'main' into uml
2 parents aa2d8e2 + c0f9650 commit a25da0a

18 files changed

+5330
-779
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ repos:
1717
args: [--profile, black]
1818
types: [python]
1919
- repo: https://github.com/ambv/black
20-
rev: 22.12.0
20+
rev: 23.3.0
2121
hooks:
2222
- id: black
2323
- repo: https://github.com/pycqa/flake8
2424
rev: 6.0.0
2525
hooks:
2626
- id: flake8
2727
- repo: https://github.com/nbQA-dev/nbQA
28-
rev: 1.6.1
28+
rev: 1.7.0
2929
hooks:
3030
- id: nbqa-black
3131
# additional_dependencies: [jupytext] # optional, only if you're using Jupytext

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,25 @@ Regression discontinuity designs are used when treatment is applied to units acc
160160

161161
> 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).
162162
163+
### Interrupted time series
164+
165+
Interrupted time series analysis is appropriate when you have a time series of observations which undergo treatment at a particular point in time. This kind of analysis has no control group and looks for the presence of a change in the outcome measure at or soon after the treatment time. Multiple predictors can be included.
166+
167+
| Time | Outcome | Treated | Predictor |
168+
|-----------|-----------|----------|----------|
169+
| $t_0$ | $y_0$ | False | $x_0$ |
170+
| $t_1$ | $y_0$ | False | $x_1$ |
171+
| $\ldots$ | $\ldots$ | $\ldots$ | $\ldots$ |
172+
| $t_{N-1}$ | $y_{N-1}$ | True | $x_{N-1}$ |
173+
| $t_N$ | $y_N$ | True | $x_N$ |
174+
175+
176+
| Frequentist | Bayesian |
177+
|--|--|
178+
| coming soon | ![](docs/source/_static/interrupted_time_series_pymc.svg) |
179+
180+
> 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).
181+
163182
## Learning resources
164183

165184
Here are some general resources about causal inference:

causalpy/data/datasets.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def load_data(dataset: str = None) -> pd.DataFrame:
3131
"""
3232

3333
if dataset in DATASETS:
34-
3534
data_dir = _get_data_home()
3635
datafile = DATASETS[dataset]
3736
file_path = data_dir / datafile["filename"]

causalpy/pymc_models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99

1010
class ModelBuilder(pm.Model):
1111
"""
12-
This is a wrapper around pm.Model to give scikit-learn like API
12+
This is a wrapper around pm.Model to give scikit-learn like API.
1313
"""
1414

1515
def __init__(self, sample_kwargs: Optional[Dict[str, Any]] = None):
16+
"""
17+
:param sample_kwargs: A dictionary of kwargs that get unpacked and passed to the
18+
:func:`pymc.sample` function. Defaults to an empty dictionary.
19+
"""
1620
super().__init__()
1721
self.idata = None
1822
self.sample_kwargs = sample_kwargs if sample_kwargs is not None else {}

causalpy/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.12"
1+
__version__ = "0.0.13"

0 commit comments

Comments
 (0)