lca.Rd
A latent class analysis with k
classes is performed on the data
given by x
.
lca(x, k, niter=100, matchdata=FALSE, verbose=FALSE)
x | Either a data matrix of binary observations or a list of
patterns as created by |
---|---|
k | Number of classes used for LCA |
niter | Number of Iterations |
matchdata | If |
verbose | If |
An object of class "lca"
is returned, containing
Probabilities to belong to each class
Probabilities of a `1' for each variable in each class
Depending on matchdata
either the class
membership of each pattern or of each data point
The LogLikelihood of the model and of the saturated model
The BIC of the model and of the saturated model
Pearson's Chisq
Likelihood quotient of the model and the saturated model
Number of data points.
Number of free parameters.
Anton K. Formann: ``Die Latent-Class-Analysis'', Beltz Verlag 1984
## Generate a 4-dim. sample with 2 latent classes of 500 data points each. ## The probabilities for the 2 classes are given by type1 and type2. type1 <- c(0.8,0.8,0.2,0.2) type2 <- c(0.2,0.2,0.8,0.8) x <- matrix(runif(4000),nr=1000) x[1:500,] <- t(t(x[1:500,])<type1)*1 x[501:1000,] <- t(t(x[501:1000,])<type2)*1 l <- lca(x, 2, niter=5) print(l)#> LCA-Result #> ---------- #> #> Datapoints: 1000 #> Classes: 2 #> Probability of classes #> [1] 0.327 0.673 #> Itemprobabilities #> 1 2 3 4 #> 1 0.87 0.94 0.07 0.13 #> 2 0.31 0.29 0.68 0.68summary(l)#> LCA-Result #> ---------- #> #> Datapoints: 1000 #> Classes: 2 #> #> Goodness of fit statistics: #> #> Number of parameters, estimated model: 9 #> Number of parameters, saturated model: 15 #> Log-Likelihood, estimated model: -2499.16 #> Log-Likelihood, saturated model: -2464.486 #> #> Information Criteria: #> #> BIC, estimated model: 5060.489 #> BIC, saturated model: 5032.589 #> #> TestStatistics: #> #> Likelihood ratio: 69.34663 p-val: 5.566658e-13 #> Pearson Chi^2: 74.1275 p-val: 5.806466e-14 #> Degress of freedom: 6#> #> p 1 2 #> 1 366 6 #> 2 134 494