Skip to content

Conversation

@penelopeysm
Copy link
Member

@penelopeysm penelopeysm commented Oct 9, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2025

Preview the changes: https://turinglang.org/docs/pr-previews/658
Please avoid using the search feature and navigation bar in PR previews!

Copy link

@nsiccha nsiccha left a 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)`).
Copy link

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,
Copy link

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,

Copy link

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)
Copy link

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.
Copy link

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 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add predict to online documentation

3 participants