posterior_samples: Extract posterior samples from a rater fit object

View source: R/posterior_samples.R

posterior_samplesR Documentation

Extract posterior samples from a rater fit object

Description

Extract posterior samples from a rater fit object

Usage

posterior_samples(fit, pars = c("pi", "theta"))

Arguments

fit

A rater fit object.

pars

A character vector of parameter names to return. By default c("pi", "theta").

Details

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.

Value

A named list of the posterior samples for each parameters. For each parameter the samples are in the form returned by rstan::extract().

Examples



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")




rater documentation built on Sept. 12, 2023, 1:13 a.m.