View source: R/posterior_samples.R
posterior_samples | R Documentation |
Extract posterior samples from a rater fit object
posterior_samples(fit, pars = c("pi", "theta"))
fit |
A rater fit object. |
pars |
A character vector of parameter names to return. By default
|
Posterior samples can only be returned for models fitting using MCMC not optimisation. In addition, posterior samples cannot be returned for the latent class due to the marginalisation technique used internally.
For the class conditional model the 'full' theta parameterisation (i.e. appearing to have the same number of parameters as the standard Dawid-Skene model) is calculated and returned. This is designed to allow easier comparison with the full Dawid-Skene model.
A named list of the posterior samples for each parameters. For each
parameter the samples are in the form returned by rstan::extract()
.
fit <- rater(anesthesia, "dawid_skene")
samples <- posterior_samples(fit)
# Look at first 6 samples for each of the pi parameters
head(samples$pi)
# Look at the first 6 samples for the theta[1, 1, 1] parameter
head(samples$theta[, 1, 1, 1])
# Only get the samples for the pi parameter:
pi_samples <- posterior_samples(fit, pars = "pi")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.