Skip to content

Commit 2a45427

Browse files
committed
More explanation
1 parent 3fc1674 commit 2a45427

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

usage/predictive-distributions/index.qmd

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,21 @@ Depending on your data, you may naturally want to create different visualisation
115115

116116
## Prior predictive distribution
117117

118-
Alternatively, if we use the prior distribution of the parameters, we obtain the *prior predictive distribution*:
118+
Alternatively, if we use the prior distribution of the parameters $p(\theta)$, we obtain the *prior predictive distribution*:
119119

120120
$$
121121
p(\tilde{x}) = \int p(\tilde{x} | \theta) p(\theta) d\theta,
122122
$$
123123

124-
This is simpler, as there is no need to pass a chain in: we can sample from the deconditioned model directly, using Turing's `Prior` sampler.
124+
In exactly analogous fashion to above, you could sample from the prior distribution of the conditioned model, and _then_ pass that to `predict`:
125+
126+
```{julia}
127+
prior_params = sample(model, Prior(), 1_000; progress=false)
128+
prior_predictive_samples = predict(predictive_model, prior_params)
129+
```
130+
131+
In fact there is a simpler way: you can directly sample from the deconditioned model, using Turing's `Prior` sampler.
132+
This will, in a single call, generate prior samples for both the parameters as well as the new data.
125133

126134
```{julia}
127135
prior_predictive_samples = sample(predictive_model, Prior(), 1_000; progress=false)

0 commit comments

Comments
 (0)