postMode {lca}R Documentation

Find Posterior Mode or Maximum Likelihood Estimate using EM Algorithm

Description

These functions can be used to (naively) find the mode of a posterior distribution for a latent class model with Dirichlet priors. This co-incides with the maximum likelihood estimator (MLE) for particular prior parameters.

Usage

postMode(dat, H, start.theta = NULL, start.eta = NULL, max.steps = 10000, tol = 1e-05, prior.theta = NULL, prior.eta = NULL)
lcaMLE(dat, H, start.theta = NULL, start.eta = NULL, max.steps = 10000, tol = 1e-05)

Arguments

dat observed data, an object of class freq.table.
H number of latent classes.
start.theta starting value for latent class proportions. Random value chosen if not specified.
start.eta starting value for other parameters.
max.steps maximum number of steps to be taken by the EM algorithm.
tol Algorithm will terminate if the sum of the absolute changes in parameter estimates from the last iteration is less than this value.
prior.theta vector containing parameters for the Dirichlet prior for the latent class proportions. This must be of length H. If NULL, defaults to rep(1,H).
prior.eta array of dimensions c(H,J,max(K)) where J is the number of items, and K is a vector of length J containing the number of possible responses to each item. Each vector prior.eta[h,j,1:K[j]] contains the Dirichlet prior parameters on those parameters. Defaults to all 1s.

Arguments

theta latent class proportions at the posterior mode (respectively MLE)
eta array of dimensions c(H,J,max(K) where eta[h,j,1:K[j]] is the response proportions of individuals in latent class h to item j.
H the number of latent classes.
J the number of items.
K vector of length J containing the number of possible responses to each item.
steps number of iterations used by algorithm.
convergence error code: 0 indicates that the algorithm stopped upon reaching convergence criterion, 1 indicates maximum number of steps was reached.

Details

postMode finds the (local) maximum of the posterior when using conjugate Dirichlet priors. Specifically, the prior on the latent class proportions is a Dirichlet with parameters prior.theta, and the prior on the responses of individuals in latent class h to item j is prior.eta[h,j,1:K[j]].

If neither prior is specified, the function defaults to all prior parameters being one, which co-incides with finding the maximum likelihood estimate. lcaMLE is a wrapper for this.

Functions handle missing values (coded as NA) by assuming them to be missing at random.

Value

A list containing theta, the latent class proportions at the posterior mode (respectively MLE), and an array eta, of dimension c(H,J,max(K)) constructed in the same way as prior.eta.

Warning

These functions are NOT guaranteed to find the global maximum, and in multi-modal problems the outcome will likely depend upon choice of starting values.

Author(s)

Robin Evans

References

Goodman, L.A. (1974) - Exploratory Latent Structure Analysis Using Both Identifiable and Unidentifiable Models, Biometrika, Vol. 61 (2), pp 215-331.

See Also

loglik.lcm, log.posterior.lcm

Examples

data(question)

out = lcaMLE(question, H=3)
out$theta
out$eta

[Package lca version 0.2 Index]