R/posterior_interval.R
posterior_interval.mcmc_fit.Rd
Extract posterior intervals for parameters of the model
# S3 method for mcmc_fit
posterior_interval(object, prob = 0.9, pars = c("pi", "theta"), ...)
A rater mcmc_fit
object.
A single probability. The size of the credible interval
returned. By default 0.9
.
The parameters to calculate the intervals for
Other arguments.
A matrix with 2 columns. The first column is the lower bound of of the credible interval and the second is the upper bound. Each row corresponds to one individuals parameters. The rownames are the parameter names.
Posterior intervals can only be calculated for models fit with MCMC. In addition, posterior intervals are not meaningful for the latent class (and indeed cannot be calculated). The full posterior distribution of the latent class can be extracted using class_probabilities
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.
# \donttest{
fit <- rater(anesthesia, "dawid_skene", verbose = FALSE, chains = 1)
intervals <- posterior_interval(fit)
head(intervals)
#> 5% 95%
#> pi[1] 0.27750048 0.4869765
#> pi[2] 0.29731585 0.5177703
#> pi[3] 0.07329299 0.2249260
#> pi[4] 0.02593994 0.1495193
#> theta[1, 1, 1] 0.78828058 0.9251812
#> theta[1, 1, 2] 0.05090186 0.1724860
# }