blca {lca} | R Documentation |
Explores the posterior surface of a Latent Class Model with Dirichlet priors. Multimodel surface is approximated for rejection sampling.
blca(dat, H, prior.theta = rep(1, H), prior.eta = NULL, n.start = 1000, lta.dir = "~/lta", tmp.dir = paste(getwd(), "/temp1", sep = ""), prop.mh = 0.1, gibbs.steps = 1000, gibbs.burn = 100, n.steps = 10000, n.thin = 1, n.burn = 1000, verbose = TRUE, parallel)
dat |
an object of class freq.table containing the observed data.
|
H |
number of latent classes. |
prior.theta |
numeric vector containing Dirichlet prior parameters for latent class proportions. |
prior.eta |
numeric array containing Dirichlet prior parameters for other model parameters. |
n.start |
number of starting points on the posterior surface to use when searching for modes. |
lta.dir |
directory containing lta32 program.
|
tmp.dir |
temporary directory to store files created by lta32 (these will be deleted afterwards).
|
prop.mh |
proportion of steps in Hybrid sampler to use general Metropolis-Hastings step. |
gibbs.steps |
number of iterations used for each Gibbs sampler when exploring modes. |
gibbs.burn |
number of iterations in each burn in for exploring modes. |
n.steps |
number of iterations for hybrid sampler. |
n.thin |
thinning factor for hybrid sampler. |
n.burn |
number of burn-in iterationg for hybrid sampler. |
verbose |
logical - should progress details be given? |
parallel |
logical - should parallel processing be used for exploring modes? Defaults to checking presence of package snowFT (which is required). Currently only works with pvm .
|
The sampler first identifies local maxima in the posterior surface; a standard Gibbs sampler will tend to get stuck in a local maxima, and not explore the entire posterior surface.
The second stage uses multiple Gibbs samplers to try and understand the shape of each local mode. Finally, a hybrid sampler runs, mixing pure Gibbs sampling steps with a generalised Metropolis-Hastings algorithm to encourage full exploration of the surface.
An object of class lcm.hybrid
, containing the details of the final sampler.
This algorithm (particularly the second stage) may take a long time to run.
Robin Evans
data(abortion) blca(abortion, 4, n.start=100)