-
Notifications
You must be signed in to change notification settings - Fork 105
Add a page on predictive distributions #658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Preview the changes: https://turinglang.org/docs/pr-previews/658 |
0458692 to
3fc1674
Compare
d635e51 to
40c8171
Compare
40c8171 to
2afb11e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the typo and the math for the posterior predictive distribution.
|
|
||
| ::: {.callout-note} | ||
| If you want to specify `X` as an argument to the model, then to mark it as being unobserved, you have to instantiate the model again with `X = missing` or `X = fill(missing, N)`. | ||
| Whether you use `missing` or `fill(missing, N)` depends on whether `X` is treated as a single distribution (e.g. with `filldist` or `product_distribution`), or as multiple independent distributions (e.g. with `.~` or a for loop over `eeachindex(X)`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: eeachindex
| Statistically, this is defined as | ||
|
|
||
| $$ | ||
| p(\tilde{x} | \theta, \mathbf{X}) = \int p(\tilde{x} | \theta) p(\theta | \mathbf{X}) d\theta, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you integrate out \theta on the right hand side, it shouldn't be a "free" parameter on the left hand side.
This should be correct:
p(\tilde{x} | \mathbf{X}) = \int p(\tilde{x} | \theta) p(\theta | \mathbf{X}) d\theta,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| This means that when the model is evaluated, it will sample a new value for `X`. | ||
|
|
||
| ```{julia} | ||
| predictive_model = decondition(model) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if we don't decondition?
| ::: {.callout-tip} | ||
| ## Reproducibility | ||
|
|
||
| `predict`, like many other Julia functions, takes an optional `rng` as its first argument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could also be "like many other random generation Julia functions" - taking that qualifier from the Random.jl docs at https://docs.julialang.org/en/v1/stdlib/Random/#Random-generation-functions
Though I feel that's a bit clunky as well 🤷
Only 3 years late (!), but closes #332.
View here: https://turinglang.org/docs/pr-previews/658/usage/predictive-distributions/