
i
i
“K23166” — 2015/1/28 — 9:35 — page 101 — #127
i
i
i
i
i
i
7.7. COMPLEX SURVEY DESIGN 101
library(MASS)
ngroups = length(levels(group))
ldamodel = lda(y ~ x1 + ... + xk, prior=rep(1/ngroups, ngroups))
print(ldamodel)
7.6.5 Latent class analysis
Latent class analysis is a technique used to classify observations based on patterns of cate-
gorical responses.
library(poLCA)
poLCA(cbind(x1, x2, ..., x3) ~ 1, maxiter=50000, nclass=k, nrep=n, data=ds)
Note: In this example, a k class model is fit. The poLCA() function requires that the
variables are coded as positive integers. Other support for latent class models can be found
in the randomLCA and the MplusAutomation ...