hybrid.lcm {lca} | R Documentation |
Use a hybrid of Metropolis-Hastings and pure Gibbs sampling to explore the posterior distribution of a Latent Class Model with Dirichlet prior distributions. The general Metropolis-Hastings steps are designed to prevent the sampler becoming ‘stuck’ in local modes in the posterior surface. The position of these modes must be specified.
hybrid.lcm(dat, H, modes, prop.mh = 0.1, N = 10000, n.thin = 1, n.burn = 1000, prior.theta = rep(1/H, H), prior.eta = NULL, start.theta = NULL, start.eta = NULL, na.ignore = FALSE, lls = TRUE, mode.weights, verbose = TRUE)
dat |
object of class freq.table containing observations.
|
H |
number of latent classes. |
modes |
matrix of Dirichlet parameters containing mode locations. |
prop.mh |
proportion of iterations to use general Metropolis-Hastings step. |
N |
total number of iterations in the main run. |
n.thin |
thinning factor for main run - used to save memory for large N .
|
n.burn |
number of iterations during burn-in. |
prior.theta |
numeric vector of length H containing Dirichlet prior parameters for latent class proportions.
|
prior.eta |
array containing Dirichlet prior parameters on other parameters. |
start.theta |
numeric vector of length H containing initial parameter values for latent class proportions.
|
start.eta |
numeric array containing initial parameter values for other parameters. |
na.ignore |
logical - should missing values be ignored? |
lls |
logical - should log-likelihood at each iteration be recorded? |
mode.weights |
numeric vector containing proportion of attempted MH jumps to each mode. |
verbose |
logical - should progress be sent to stdout? |
The MCMC sampling works as follows: at each step, a general Metropolis Hastings (MH) step is chosen with probability prop.mh
, otherwise a Gibbs sampling step is selected. The MH step selects from a proposal distribution which is a mixture based upon the locations of the modes in the posterior. The proposals are independent of the current parameter estimates.
Specifically, each mode is approximated using a product of Dirichlet distributions (one for each set of parameters constrained to sum to 1) whose parameters are given in modes
. To ensure irreducibility, the mixture includes a proposal which is uniform in the whole parameter space.
An object of class lcm.hybrid
[[1]] |
a numeric matrix containing parameter estimates at each iteration. Each row represents a single saved iteration, and each column a parameter, thus there are N/n.thin rows in total. |
H |
H . |
J |
the number of items. |
K |
a numeric vector containing the number of possible responses to each item. |
dat |
dat . |
ll |
a list containing the value of the log-likelihood at each iteration. |
modes.visited |
|
moved |
logical vector explaining whether a proposed MH step was accepted. Gibbs steps coded as NA . |
Robin Evans
Tierney, L. (1994) - Markov Chains for Exploring Posterior Distributions