Skip to content

Commit b92b606

Browse files
committed
Merge branch 'main' into iv_weak_instruments
2 parents fcf2626 + 6dc7fc0 commit b92b606

File tree

8 files changed

+12
-61
lines changed

8 files changed

+12
-61
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: ["3.10", "3.11"]
14+
python-version: ["3.10", "3.11", "3.12"]
1515

1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
- name: Set up Python
19-
uses: actions/setup-python@v3
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: ${{ matrix.python-version }}
22+
- name: Update pip and setuptools
23+
run: pip install --upgrade pip setuptools
2224
- name: Run doctests
2325
run: |
2426
pip install -e .[test]
@@ -28,7 +30,7 @@ jobs:
2830
pip install -e .[test]
2931
pytest --cov-report=xml --no-cov-on-fail
3032
- name: Upload coverage to Codecov
31-
uses: codecov/codecov-action@v3
33+
uses: codecov/codecov-action@v4
3234
with:
3335
token: ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
3436
name: ${{ matrix.python-version }}

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
name: Build source distribution
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
18-
- uses: actions/setup-python@v4
18+
- uses: actions/setup-python@v5
1919
with:
2020
python-version: 3.11
2121
- name: Build the sdist and the wheel
@@ -60,7 +60,7 @@ jobs:
6060
user: __token__
6161
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
6262
repository_url: https://test.pypi.org/legacy/
63-
- uses: actions/setup-python@v4
63+
- uses: actions/setup-python@v5
6464
with:
6565
python-version: 3.11
6666
- name: Test pip install from test.pypi

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repos:
2525
exclude: &exclude_pattern 'iv_weak_instruments.ipynb'
2626
args: ["--maxkb=1500"]
2727
- repo: https://github.com/astral-sh/ruff-pre-commit
28-
rev: v0.4.4
28+
rev: v0.4.7
2929
hooks:
3030
- id: ruff
3131
args: ["--fix", "--output-format=full"]

causalpy/pymc_experiments.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,6 @@ def print_coefficients(self, round_to=None) -> None:
102102
... "progressbar": False
103103
... }),
104104
... )
105-
<BLANKLINE>
106-
<BLANKLINE>
107-
<BLANKLINE>
108-
<BLANKLINE>
109-
<BLANKLINE>
110105
>>> result.print_coefficients(round_to=1) # doctest: +NUMBER
111106
Model coefficients:
112107
Intercept 1, 94% HDI [1, 1]
@@ -165,11 +160,6 @@ class PrePostFit(ExperimentalDesign, PrePostFitDataValidator):
165160
... }
166161
... ),
167162
... )
168-
<BLANKLINE>
169-
<BLANKLINE>
170-
<BLANKLINE>
171-
<BLANKLINE>
172-
<BLANKLINE>
173163
>>> result.summary(round_to=1) # doctest: +NUMBER
174164
==================================Pre-Post Fit==================================
175165
Formula: actual ~ 0 + a + g
@@ -396,11 +386,6 @@ class InterruptedTimeSeries(PrePostFit):
396386
... }
397387
... )
398388
... )
399-
<BLANKLINE>
400-
<BLANKLINE>
401-
<BLANKLINE>
402-
<BLANKLINE>
403-
<BLANKLINE>
404389
"""
405390

406391
expt_type = "Interrupted Time Series"
@@ -436,11 +421,6 @@ class SyntheticControl(PrePostFit):
436421
... }
437422
... ),
438423
... )
439-
<BLANKLINE>
440-
<BLANKLINE>
441-
<BLANKLINE>
442-
<BLANKLINE>
443-
<BLANKLINE>
444424
"""
445425

446426
expt_type = "Synthetic Control"
@@ -497,11 +477,6 @@ class DifferenceInDifferences(ExperimentalDesign, DiDDataValidator):
497477
... }
498478
... )
499479
... )
500-
<BLANKLINE>
501-
<BLANKLINE>
502-
<BLANKLINE>
503-
<BLANKLINE>
504-
<BLANKLINE>
505480
"""
506481

507482
def __init__(
@@ -793,11 +768,6 @@ class RegressionDiscontinuity(ExperimentalDesign, RDDataValidator):
793768
... ),
794769
... treatment_threshold=0.5,
795770
... )
796-
<BLANKLINE>
797-
<BLANKLINE>
798-
<BLANKLINE>
799-
<BLANKLINE>
800-
<BLANKLINE>
801771
"""
802772

803773
def __init__(
@@ -1207,10 +1177,6 @@ class PrePostNEGD(ExperimentalDesign, PrePostNEGDDataValidator):
12071177
... }
12081178
... )
12091179
... )
1210-
<BLANKLINE>
1211-
<BLANKLINE>
1212-
<BLANKLINE>
1213-
<BLANKLINE>
12141180
>>> result.summary(round_to=1) # doctest: +NUMBER
12151181
==================Pretest/posttest Nonequivalent Group Design===================
12161182
Formula: post ~ 1 + C(group) + pre
@@ -1441,8 +1407,6 @@ class InstrumentalVariable(ExperimentalDesign, IVDataValidator):
14411407
... formula=formula,
14421408
... model=InstrumentalVariableRegression(sample_kwargs=sample_kwargs),
14431409
... )
1444-
<BLANKLINE>
1445-
<BLANKLINE>
14461410
"""
14471411

14481412
def __init__(
@@ -1568,8 +1532,6 @@ class InversePropensityWeighting(ExperimentalDesign, PropensityDataValidator):
15681532
... },
15691533
... ),
15701534
... )
1571-
<BLANKLINE>
1572-
<BLANKLINE>
15731535
"""
15741536

15751537
def __init__(

causalpy/pymc_models.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,11 @@ class ModelBuilder(pm.Model):
7272
... }
7373
... )
7474
>>> model.fit(X, y)
75-
<BLANKLINE>
76-
<BLANKLINE>
7775
Inference data...
7876
>>> X_new = rng.normal(loc=0, scale=1, size=(20,2))
7977
>>> model.predict(X_new)
80-
<BLANKLINE>
8178
Inference data...
8279
>>> model.score(X, y)
83-
<BLANKLINE>
8480
r2 0.390344
8581
r2_std 0.081135
8682
dtype: float64
@@ -201,8 +197,6 @@ class WeightedSumFitter(ModelBuilder):
201197
>>> y = np.asarray(sc['actual']).reshape((sc.shape[0], 1))
202198
>>> wsf = WeightedSumFitter(sample_kwargs={"progressbar": False})
203199
>>> wsf.fit(X,y)
204-
<BLANKLINE>
205-
<BLANKLINE>
206200
Inference data...
207201
""" # noqa: W605
208202

@@ -259,8 +253,6 @@ class LinearRegression(ModelBuilder):
259253
... 'obs_indx': np.arange(rd.shape[0])
260254
... },
261255
... )
262-
<BLANKLINE>
263-
<BLANKLINE>
264256
Inference data...
265257
""" # noqa: W605
266258

@@ -313,8 +305,6 @@ class InstrumentalVariableRegression(ModelBuilder):
313305
... "eta": 2,
314306
... "lkj_sd": 2,
315307
... })
316-
<BLANKLINE>
317-
<BLANKLINE>
318308
Inference data...
319309
"""
320310

@@ -435,8 +425,6 @@ class PropensityScore(ModelBuilder):
435425
... 'obs_indx': np.arange(df.shape[0])
436426
... },
437427
... )
438-
<BLANKLINE>
439-
<BLANKLINE>
440428
Inference...
441429
""" # noqa: W605
442430

causalpy/skl_experiments.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,6 @@ class RegressionDiscontinuity(ExperimentalDesign, RDDataValidator):
547547
Formula: y ~ 1 + x + treated
548548
Running variable: x
549549
Threshold on running variable: 0.5
550-
<BLANKLINE>
551550
Results:
552551
Discontinuity at threshold = 0.19
553552
Model coefficients:

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependencies:
99
- numpy<1.26.0
1010
- pandas
1111
- patsy
12-
- pymc>=5.14.0
12+
- pymc>=5.15.1
1313
- scikit-learn>=1
1414
- scipy
1515
- seaborn>=0.11.2

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies = [
3131
"graphviz",
3232
"ipython!=8.7.0",
3333
"matplotlib>=3.5.3",
34-
"numpy<1.26.0",
34+
"numpy",
3535
"pandas",
3636
"patsy",
3737
"pymc>=5.14.0",

0 commit comments

Comments
 (0)