Skip to content

Commit 35cd42f

Browse files
Conditional autoregressive priors (#547)
* CAR notebook * implementing oriol's suggestions + typo * changed aesara.tensor to pytensor.tensor * fixed execution order, made watermark render properly * syncing myst nb to ipynb * fix latex rendering * oriol's suggestions + simplified pm.sample() arguments + removed discussion of divergences * oriol's suggestions + simplified pm.sample() arguments + removed discussion of divergences * metadata for myst substitutions * metadata for myst substitutions * still trying to get metadata right * adjust title for old CAR notebook + correct myst substitutions syntax * fixing preamble in previous commit * change reference to conditional_autoregressive_prior -> conditional_autoregressive_priors * reference -> explanation --------- Co-authored-by: conorhassan <[email protected]>
1 parent ab389da commit 35cd42f

5 files changed

+1540
-28
lines changed

examples/case_studies/conditional-autoregressive-model.ipynb

+33-23
Large diffs are not rendered by default.

examples/case_studies/conditional-autoregressive-model.myst.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@ kernelspec:
1010
name: python3
1111
---
1212

13+
(conditional_autoregressive_model)=
14+
(about_CAR_models_in_pymc)=
15+
16+
# About Conditional Autoregressive models in PyMC
17+
18+
:::{post} Aug 14, 2020
19+
:tags: spatial, autoregressive, count data
20+
:category: advanced, explanation
21+
:author: Junpeng Lao
22+
:::
23+
24+
This notebook explains the design principles behind the Conditional Autoregressive (CAR) distribution as implemented in PyMC. For a simple tutorial of why and how to use the CAR distribution, see {ref}`this notebook <conditional_autoregressive_priors>`.
25+
1326
```{code-cell} ipython3
1427
import arviz as az
1528
import numpy as np
@@ -31,11 +44,6 @@ az.style.use("arviz-darkgrid")
3144
floatX = "float32"
3245
```
3346

34-
# Conditional Autoregressive (CAR) model
35-
A walkthrough of implementing a Conditional Autoregressive (CAR) model in `PyMC3`, with `WinBUGS`/`PyMC2` and `Stan` code as references.
36-
37-
+++
38-
3947
As a probabilistic language, there are some fundamental differences between `PyMC3` and other alternatives such as `WinBUGS`, `JAGS`, and `Stan`. In this notebook, I will summarise some heuristics and intuition I got over the past two years using `PyMC3`. I will outline some thinking in how I approach a modelling problem using `PyMC3`, and how thinking in linear algebra solves most of the programming problems. I hope this notebook will shed some light onto the design and features of `PyMC3`, and similar languages that are built on linear algebra packages with a static world view (e.g., Edward, which is based on Tensorflow).
4048

4149

0 commit comments

Comments
 (0)