Learn R Programming

svs (version 1.0.2)

fast_E_M: EM clustering

Description

A fast procedure for Expectation-Maximization clustering.

Usage

fast_E_M(dat, k, tol = 1e-08)

fast_EM(dat, k, tol = 1e-08)

Arguments

dat
Input data: can be a table or a data frame (but the data frame must have only two columns).
k
Numeric specification of the number of latent classes to compute.
tol
Numeric specification of the convergence criterion.

Value

  • A list with components:
  • prob0The probabilities of the latent classes.
  • prob1The probabilities for the first set of levels (viz. the row levels of a frequency table). The rows of prob1 sum to 1.
  • prob2The probabilities for the second set of levels (viz. the column levels of a frequency table). The rows of prob2 sum to 1.

Details

This function assumes that the rows of a frequency table come from a multinomial distribution. The prior probabilities of the latent classes are initialized with a Dirichlet distribution (by means of rdirichlet from the package gtools).

Examples

Run this code
SndT_Fra <- read.table(system.file("extdata", "SndT_Fra.txt", package = "svs"),
   header = TRUE, sep = "\t", quote = "\"", encoding = "UTF-8")
E_M.SndT_Fra <- fast_E_M(SndT_Fra, k = 7)
E_M.SndT_Fra
}
references{
Dempster, A. P., N. M. Laird and D. B. Rubin (1977) Maximum likelihood from incomplete data via the EM algorithm.
  emph{Journal of the royal statistical society, series B} strong{39} (1), 1--38.
}

Run the code above in your browser using DataLab