Skip to content

Commit 8b2effe

Browse files
author
Chris Fonnesbeck
committed
Merge remote-tracking branch 'upstream/main'
2 parents 95328be + 56a40b5 commit 8b2effe

26 files changed

+7168
-1730
lines changed

examples/case_studies/mediation_analysis.ipynb

Lines changed: 260 additions & 235 deletions
Large diffs are not rendered by default.

examples/case_studies/mediation_analysis.myst.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ jupytext:
55
format_name: myst
66
format_version: 0.13
77
kernelspec:
8-
display_name: Python 3 (ipykernel)
8+
display_name: pymc_env
99
language: python
10-
name: python3
10+
name: pymc_env
1111
---
1212

1313
(mediation_analysis)=
@@ -182,7 +182,7 @@ with pm.Model() as total_effect_model:
182182
c = pm.Normal("c", mu=0, sigma=1)
183183
σy = pm.HalfCauchy("σy", 1)
184184
μy = iy + c * _x
185-
pm.Normal("yy", mu=μy, sd=σy, observed=y, dims="obs_id")
185+
pm.Normal("yy", mu=μy, sigma=σy, observed=y, dims="obs_id")
186186
```
187187

188188
```{code-cell} ipython3

examples/case_studies/moderation_analysis.ipynb

Lines changed: 138 additions & 131 deletions
Large diffs are not rendered by default.

examples/case_studies/moderation_analysis.myst.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ jupytext:
55
format_name: myst
66
format_version: 0.13
77
kernelspec:
8-
display_name: pymc-dev-py39
8+
display_name: pymc_env
99
language: python
10-
name: pymc-dev-py39
10+
name: pymc_env
1111
---
1212

1313
(moderation_analysis)=
@@ -234,13 +234,13 @@ def model_factory(x, m, y):
234234
x = pm.ConstantData("x", x)
235235
m = pm.ConstantData("m", m)
236236
# priors
237-
β0 = pm.Normal("β0", mu=0, sd=10)
238-
β1 = pm.Normal("β1", mu=0, sd=10)
239-
β2 = pm.Normal("β2", mu=0, sd=10)
240-
β3 = pm.Normal("β3", mu=0, sd=10)
237+
β0 = pm.Normal("β0", mu=0, sigma=10)
238+
β1 = pm.Normal("β1", mu=0, sigma=10)
239+
β2 = pm.Normal("β2", mu=0, sigma=10)
240+
β3 = pm.Normal("β3", mu=0, sigma=10)
241241
σ = pm.HalfCauchy("σ", 1)
242242
# likelihood
243-
y = pm.Normal("y", mu=β0 + (β1 * x) + (β2 * x * m) + (β3 * m), sd=σ, observed=y, dims="obs")
243+
y = pm.Normal("y", mu=β0 + (β1 * x) + (β2 * x * m) + (β3 * m), sigma=σ, observed=y)
244244
245245
return model
246246
```
@@ -361,6 +361,7 @@ But readers are strongly encouraged to read {cite:t}`mcclelland2017multicollinea
361361
## Authors
362362
- Authored by Benjamin T. Vincent in June 2021
363363
- Updated by Benjamin T. Vincent in March 2022
364+
- Updated by Benjamin T. Vincent in February 2023 to run on PyMC v5
364365

365366
+++
366367

examples/case_studies/stochastic_volatility.ipynb

Lines changed: 130 additions & 188 deletions
Large diffs are not rendered by default.

examples/case_studies/stochastic_volatility.myst.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ jupytext:
55
format_name: myst
66
format_version: 0.13
77
kernelspec:
8-
display_name: pymc_env
8+
display_name: Python 3 (ipykernel)
99
language: python
10-
name: pymc_env
10+
name: python3
1111
---
1212

1313
(stochastic_volatility)=
@@ -16,7 +16,7 @@ kernelspec:
1616
:::{post} June 17, 2022
1717
:tags: time series, case study
1818
:category: beginner
19-
:author: John Salvatier
19+
:author: John Salvatier, Colin Carroll, Abhipsha Das
2020
:::
2121

2222
```{code-cell} ipython3
@@ -79,7 +79,9 @@ Specifying the model in `PyMC` mirrors its statistical specification.
7979
def make_stochastic_volatility_model(data):
8080
with pm.Model(coords={"time": data.index.values}) as model:
8181
step_size = pm.Exponential("step_size", 10)
82-
volatility = pm.GaussianRandomWalk("volatility", sigma=step_size, dims="time")
82+
volatility = pm.GaussianRandomWalk(
83+
"volatility", sigma=step_size, dims="time", init_dist=pm.Normal.dist(0, 100)
84+
)
8385
nu = pm.Exponential("nu", 0.1)
8486
returns = pm.StudentT(
8587
"returns", nu=nu, lam=np.exp(-2 * volatility), observed=data["change"], dims="time"
@@ -212,6 +214,7 @@ axes[1].set_title("Posterior volatility");
212214
* Updated by Abhipsha Das on July 24, 2021 ([pymc-examples#155](https://github.com/pymc-devs/pymc-examples/pull/155))
213215
* Updated by Michael Osthege on June 1, 2022 ([pymc-examples#343](https://github.com/pymc-devs/pymc-examples/pull/343))
214216
* Updated by Christopher Krapu on June 17, 2022 ([pymc-examples#378](https://github.com/pymc-devs/pymc-examples/pull/378))
217+
* Updated for compatibility with PyMC v5 by Beryl Kanali and Sangam Swadik on Jan 22, 2023 ([pymc-examples#517](https://github.com/pymc-devs/pymc-examples/pull/517))
215218

216219
+++
217220

examples/causal_inference/difference_in_differences.ipynb

Lines changed: 132 additions & 110 deletions
Large diffs are not rendered by default.

examples/causal_inference/difference_in_differences.myst.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ Of course, when using the difference in differences approach for real applicatio
437437

438438
## Authors
439439
- Authored by [Benjamin T. Vincent](https://github.com/drbenvincent) in Sept 2022 ([#424](https://github.com/pymc-devs/pymc-examples/pull/424)).
440+
- Updated by Benjamin T. Vincent in February 2023 to run on PyMC v5
440441

441442
+++
442443

examples/causal_inference/excess_deaths.ipynb

Lines changed: 242 additions & 218 deletions
Large diffs are not rendered by default.

examples/causal_inference/excess_deaths.myst.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ The bad news of course, is that as of the last data point (May 2022) the number
488488

489489
## Authors
490490
- Authored by [Benjamin T. Vincent](https://github.com/drbenvincent) in July 2022.
491+
- Updated by Benjamin T. Vincent in February 2023 to run on PyMC v5
491492

492493
+++
493494

0 commit comments

Comments
 (0)