postMode {lca} | R Documentation |
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.
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)
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.
|
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. |
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.
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
.
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.
Robin Evans
Goodman, L.A. (1974) - Exploratory Latent Structure Analysis Using Both Identifiable and Unidentifiable Models, Biometrika, Vol. 61 (2), pp 215-331.
data(question) out = lcaMLE(question, H=3) out$theta out$eta