Learn R Programming

e1071 (version 1.5-15)

bootstrap.lca: Bootstrap Samples of LCA Results

Description

This function draws bootstrap samples from a given LCA model and refits a new LCA model for each sample. The quality of fit of these models is compared to the original model.

Usage

bootstrap.lca(l, nsamples=10, lcaiter=30, verbose=FALSE)

Arguments

l
An LCA model as created by lca
nsamples
Number of bootstrap samples
lcaiter
Number of LCA iterations
verbose
If TRUE some output is printed during the computations.

Value

  • An object of class bootstrap.lca is returned, containing
  • logl, loglsatThe LogLikelihood of the models and of the corresponding saturated models
  • lratioLikelihood quotient of the models and the coresponding saturated models
  • lratiomean, lratiosdMean and Standard deviation of lratio
  • lratioorgLikelihood quotient of the original model and the correspomdiong saturated model
  • zratioZ-Statistics of lratioorg
  • pvalzratio, pvalratioP-Values for zratio, computed via normal distribution and empirical distribution
  • chisqPearson's Chisq of the models
  • chisqmean, chisqsdMean and Standard deviation of chisq
  • chisqorgPearson's Chisq of the original model
  • zchisqZ-Statistics of chisqorg
  • pvalzchisq, pvalchisqP-Values for zchisq, computed via normal distribution and empirical distribution
  • nsamplesNumber of bootstrap samples
  • lcaiterNumber of LCA Iterations

Details

From a given LCA model l, 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.

References

Anton K. Formann: ``Die Latent-Class-Analysis'', Beltz Verlag 1984

See Also

lca

Examples

Run this code
## 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