LC.CL: LC.CL function

Description Usage Arguments Details Examples

View source: R/LC.CL.R

Description

This function estimates parameters of the latent class model using the composite likelihood. As a subroutine it uses constrOptim().

Usage

1
LC.CL(counts, k, tries = 3, theta = NULL, tol = 1e-08, margin.size = 3)

Arguments

counts

The array of counts of format (r[1],...,r[m])

k

The number of latent classes fitted

tries

The number of times the 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.

margin.size

The size of the margins that will be included in the construction of the composite likelihood.

Details

In this first version there is no way to specify the margins that will be taken into account in the construction of the composite likelihood function. Instead, for a given margin.size all margins of this size are taken into account. The defult is 3 because the latent class model is identified from all the triples.

Examples

1
2
3
4
5
6
7
8
9
theta0 <- list()
theta0[[1]] <- matrix(c(0.9,0.2,0.1,0.8),2,2)
theta0[[2]] <- matrix(c(0.7,0.2,0.3,0.8),2,2)
theta0[[3]] <- matrix(c(0.9,0.1,0.1,0.9),2,2)
theta0[[4]] <- matrix(c(0.7,0.1,0.3,0.9),2,2)
theta0[[5]] <- matrix(c(0.7,0.1,0.3,0.9),2,2)
theta0[[6]] <- c(0.3,0.7)
data <- sample.counts(500,theta0)
LC.CL(data,2,tries=3,tol=1e-8,margin.size=3)

pzwiernik/LatentClass documentation built on May 26, 2019, 11:35 a.m.