Skip to content

Commit 78f5794

Browse files
authored
Multiple updates to v5 (#516)
* update notebooks authored by Ben Vincent to v5
1 parent cef367c commit 78f5794

20 files changed

+1688
-1485
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/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

examples/causal_inference/interrupted_time_series.ipynb

Lines changed: 116 additions & 94 deletions
Large diffs are not rendered by default.

examples/causal_inference/interrupted_time_series.myst.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ There are of course many ways that the interrupted time series approach could be
348348

349349
## Authors
350350
- Authored by [Benjamin T. Vincent](https://github.com/drbenvincent) in October 2022.
351+
- Updated by Benjamin T. Vincent in February 2023 to run on PyMC v5
351352

352353
+++
353354

examples/causal_inference/regression_discontinuity.ipynb

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

examples/causal_inference/regression_discontinuity.myst.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ jupytext:
66
format_name: myst
77
format_version: 0.13
88
kernelspec:
9-
display_name: pymc-dev-py39
9+
display_name: pymc_env
1010
language: python
11-
name: pymc-dev-py39
11+
name: pymc_env
1212
---
1313

1414
(regression_discontinuity)=
@@ -229,6 +229,7 @@ In this notebook we have merely touched the surface of how to analyse data from
229229

230230
## Authors
231231
- Authored by [Benjamin T. Vincent](https://github.com/drbenvincent) in April 2022
232+
- Updated by Benjamin T. Vincent in February 2023 to run on PyMC v5
232233

233234
+++
234235

examples/generalized_linear_models/GLM-binomial-regression.ipynb

Lines changed: 92 additions & 82 deletions
Large diffs are not rendered by default.

examples/generalized_linear_models/GLM-binomial-regression.myst.md

Lines changed: 3 additions & 2 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
(GLM-binomial-regression)=
@@ -237,6 +237,7 @@ A good introduction to generalized linear models is provided by {cite:t}`roback2
237237
## Authors
238238
- Authored by [Benjamin T. Vincent](https://github.com/drbenvincent) in July 2021
239239
- Updated by [Benjamin T. Vincent](https://github.com/drbenvincent) in February 2022
240+
- Updated by Benjamin T. Vincent in February 2023 to run on PyMC v5
240241

241242
+++
242243

examples/generalized_linear_models/GLM-simpsons-paradox.ipynb

Lines changed: 480 additions & 392 deletions
Large diffs are not rendered by default.

examples/generalized_linear_models/GLM-simpsons-paradox.myst.md

Lines changed: 3 additions & 2 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
(GLM-simpsons-paradox)=
@@ -544,6 +544,7 @@ If you are interested in learning more, there are a number of other [PyMC exampl
544544
## Authors
545545
* Authored by [Benjamin T. Vincent](https://github.com/drbenvincent) in July 2021
546546
* Updated by [Benjamin T. Vincent](https://github.com/drbenvincent) in April 2022
547+
* Updated by Benjamin T. Vincent in February 2023 to run on PyMC v5
547548

548549
+++
549550

examples/generalized_linear_models/GLM-truncated-censored-regression.ipynb

Lines changed: 26 additions & 25 deletions
Large diffs are not rendered by default.

examples/generalized_linear_models/GLM-truncated-censored-regression.myst.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jupytext:
55
format_name: myst
66
format_version: 0.13
77
kernelspec:
8-
display_name: Python 3.10.6 ('pymc_env')
8+
display_name: Python 3 (ipykernel)
99
language: python
1010
name: python3
1111
---
@@ -361,6 +361,7 @@ When looking into this topic, I found that most of the material out there focuse
361361
* Authored by [Benjamin T. Vincent](https://github.com/drbenvincent) in May 2021
362362
* Updated by [Benjamin T. Vincent](https://github.com/drbenvincent) in January 2022
363363
* Updated by [Benjamin T. Vincent](https://github.com/drbenvincent) in September 2022
364+
* Updated by Benjamin T. Vincent in February 2023 to run on PyMC v5
364365

365366
+++
366367

examples/mixture_models/gaussian_mixture_model.ipynb

Lines changed: 63 additions & 84 deletions
Large diffs are not rendered by default.

examples/mixture_models/gaussian_mixture_model.myst.md

Lines changed: 4 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: pymc-dev-py39
8+
display_name: pymc_env
99
language: python
10-
name: pymc-dev-py39
10+
name: pymc_env
1111
---
1212

1313
(gaussian_mixture_model)=
@@ -63,7 +63,7 @@ with pm.Model(coords={"cluster": range(k)}) as model:
6363
"μ",
6464
mu=0,
6565
sigma=5,
66-
transform=pm.distributions.transforms.ordered,
66+
transform=pm.distributions.transforms.univariate_ordered,
6767
initval=[-4, 0, 4],
6868
dims="cluster",
6969
)
@@ -109,6 +109,7 @@ ax[2].set(title="Group membership", xlabel="x", ylabel="Probability");
109109
- Authored by Abe Flaxman.
110110
- Updated by Thomas Wiecki.
111111
- Updated by [Benjamin T. Vincent](https://github.com/drbenvincent) in April 2022 ([#310](https://github.com/pymc-devs/pymc-examples/pull/310)) to use `pm.NormalMixture`.
112+
- Updated by Benjamin T. Vincent in February 2023 to run on PyMC v5.
112113

113114
+++
114115

0 commit comments

Comments
 (0)