Description Usage Arguments Examples
This function estimates parameters of the latent class model using the standard EM algorithm.
1 |
counts |
The array of counts of format (r[1],...,r[m]) |
k |
The number of latent classes fitted |
tries |
The number of times the EM algorithm reruns from different random starting points. The default value is tries=3 |
theta |
The vector of parameters from which the algorithm starts. If not specified, the algorithm starts from a random point. |
tol |
The convergence criterion for the EM algorithm. The maximal decrease of the log-likelihood function that will terminate the algorithm. |
1 2 3 4 5 6 7 8 9 10 | theta0 <- list()
length(theta0) <- 5
theta0[[1]] <- matrix(c(0.8,1-0.7,1-0.8,0.7),2,2)
theta0[[2]] <- matrix(c(0.8,1-0.7,1-0.8,0.7),2,2)
theta0[[3]] <- matrix(c(0.8,1-0.7,1-0.8,0.7),2,2)
theta0[[4]] <- matrix(c(0.8,1-0.9,1-0.8,0.9),2,2)
theta0[[5]] <- c(1-0.7,0.7)
n <- 1000
counts <- sample.counts(n, theta0)
EM(counts,2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.