Skip to content

Commit 1a550ac

Browse files
committed
Added text to clarify difference in posterior draws and posterior predictions
1 parent 61370bc commit 1a550ac

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

knitr/hmm-example/hmm-example.Rmd

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ There are three functions
4545

4646
- `hmm_marginal` - The likelihood of an HMM with the hidden discrete states
4747
integrated out
48-
- `hmm_latent_rng` - A function to generate draws of the hidden state that are
48+
- `hmm_latent_rng` - A function to generate posterior draws of the hidden state that are
4949
implicitly integrated out of the model when using `hmm_marginal` (this is
5050
different than sampling more states with a posterior draw of a transition matrix
5151
and initial state)
52-
- `hmm_hidden_state_prob` - A function to compute the distributions of the
52+
- `hmm_hidden_state_prob` - A function to compute the posterior distributions of the
5353
integrated out hidden states
5454

5555
This guide will demonstrate how to simulate HMM realizations in R, fit the data
@@ -271,11 +271,16 @@ generated quantities {
271271
}
272272
```
273273

274-
Note, these are the probabilities and draws of the hidden state that was
275-
integrated out. This is different than sampling new HMM realizations using
276-
posterior draws of the initial condition and the transition matrix.
274+
Note that the probabilities from `hmm_hidden_state_prob` are the marginal
275+
probabilities of the hidden states, meaning they cannot be directly used to
276+
jointly sample hidden states. The posterior draws generated by `hmm_latent_rng`
277+
account for the correlation between hidden states.
277278

278-
These can be plotted as well:
279+
Note further these are draws of the hidden state that was integrated out. This is
280+
different than sampling new HMM realizations using posterior draws of the initial
281+
condition and the transition matrix.
282+
283+
The draws of the hidden state can be plotted as well:
279284

280285
```{r}
281286
y_sim = fit$draws() %>%

0 commit comments

Comments
 (0)