bootstrap.lca(l, nsamples=10, lcaiter=30, verbose=FALSE)
lca
TRUE
some output is printed during the
computations.bootstrap.lca
is returned, containinglratio
lratioorg
zratio
, computed via normal
distribution and empirical distributionchisq
chisqorg
zchisq
, computed via normal
distribution and empirical distributionl
, nsamples
bootstrap samples are
drawn. For each sample a new LCA model is fitted. The goodness of fit
for each model is computed via Likelihood Ratio and Pearson's
Chisquare. The values for the fitted models are compared with the values
of the original model l
. By this method it can be tested whether
the data to which l
was originally fitted come from an LCA model.lca
## 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)
bl <- bootstrap.lca(l,nsamples=3,lcaiter=5)
bl
Run the code above in your browser using DataLab