em.default {em}R Documentation

The default em function

Description

The default em function

Usage

## Default S3 method:
em(
  object,
  latent = 2,
  verbose = FALSE,
  init.method = c("random", "kmeans", "hc"),
  init.prob = NULL,
  algo = c("em", "cem", "sem"),
  cluster.by = NULL,
  max_iter = 500,
  abs_tol = 1e-04,
  concomitant = list(...),
  use.optim = FALSE,
  optim.start = c("random", "sample5"),
  ...
)

Arguments

object

the model used, e.g. 'lm', 'glm', 'gnm'.

latent

the number of latent classes.

verbose

'True' to print the process of convergence.

init.method

the initialization method used in the model. The default method is 'random'. 'kmeans' is K-means clustering. 'hc' is model-based agglomerative hierarchical clustering.

init.prob

the starting prior probabilities used in classification based method.

algo

the algorithm used in em: 'em' the default EM algorithm, the classification em 'cem', or the stochastic em 'sem'.

cluster.by

a variable to define the level of clustering.

max_iter

the maximum iteration for em algorithm.

abs_tol

absolute accuracy requested.

concomitant

the formula to define the concomitant part of the model. The default is NULL.

use.optim

maximize the complete log likelihood (MLE) by using 'optim' and 'rcpp' code.The default value is 'FALSE'.

optim.start

the initialization method of generating the starting value for MLE.

...

arguments used in the 'model'.

Value

An object of class 'em' is a list containing at least the following components: models a list of models/objects whose class are determined by a model fitting from the previous step. pi the prior probabilities. latent number of the latent classes. algorithm the algorithm used (could be either 'em', 'sem' or 'cem'). obs the number of observations. post_pr the posterior probabilities. concomitant a list of the concomitant model. It is empty if no concomitant model is used. init.method the initialization method used. call the matched call. terms the codeterms object used.


[Package em version 1.0.0 Index]