apollo_lcEM {apollo}R Documentation

Uses EM for latent class model


Uses the EM algorithm for estimating a latent class model.


  lcEM_settings = NA,
  estimate_settings = NA



Named numeric vector. Names and values for parameters.


Character vector. Names (as defined in apollo_beta) of parameters whose value should not change during estimation.


Function. Returns probabilities of the model to be estimated. Must receive three arguments:

  • apollo_beta: Named numeric vector. Names and values of model parameters.

  • apollo_inputs: List containing options of the model. See apollo_validateInputs.

  • functionality: Character. Can be either "components", "conditionals", "estimate" (default), "gradient", "output", "prediction", "preprocess", "raw", "report", "shares_LL", "validate" or "zero_LL".


List grouping most common inputs. Created by function apollo_validateInputs.


List. Options controlling the EM process.

  • EMmaxIterations: Numeric. Maximum number of iterations of the EM algorithm before stopping. Default is 100.

  • postEM: Numeric scalar. Determines the tasks performed by this function after the EM algorithm has converged. Can take values 0, 1 or 2 only. If value is 0, only the EM algorithm will be performed, and the results will be a model object without a covariance matrix (i.e. estimates only). If value is 1, after the EM algorithm, the covariance matrix of the model will be calculated as well, and the result will be a model object with a covariance matrix. If value is 2, after the EM algorithm, the estimated parameter values will be used as starting value for a maximum likelihood estimation process, which will render a model object with a covariance matrix. Performing maximum likelihood estimation after the EM algorithm is useful, as there may be room for further improvement. Default is 2.

  • silent: Boolean. If TRUE, no information is printed to the console during estimation. Default is FALSE.

  • stoppingCriterion: Numeric. Convergence criterion. The EM process will stop when improvements in the log-likelihood fall below this value. Default is 10^-5.


List. Options controlling the estimation process within each EM iteration. See apollo_estimate for details.


This function uses the EM algorithm for estimating a Latent Class model. It is only suitable for models without continuous mixing. All parameters need to vary across classes and need to be included in the apollo_lcPars function which is used by apollo_lcEM.


model object

[Package apollo version 0.2.8 Index]