Bootstrap Samples of LCA Results
bootstrap.lca.RdThis 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.
Arguments
- l
An LCA model as created by
lca- nsamples
Number of bootstrap samples
- lcaiter
Number of LCA iterations
- verbose
If
TRUEsome output is printed during the computations.
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.
Value
An object of class bootstrap.lca is returned, containing
- logl, loglsat
The LogLikelihood of the models and of the corresponding saturated models
- lratio
Likelihood quotient of the models and the corresponding saturated models
- lratiomean, lratiosd
Mean and Standard deviation of
lratio- lratioorg
Likelihood quotient of the original model and the corresponding saturated model
- zratio
Z-Statistics of
lratioorg- pvalzratio, pvalratio
P-Values for
zratio, computed via normal distribution and empirical distribution- chisq
Pearson's Chisq of the models
- chisqmean, chisqsd
Mean and Standard deviation of
chisq- chisqorg
Pearson's Chisq of the original model
- zchisq
Z-Statistics of
chisqorg- pvalzchisq, pvalchisq
P-Values for
zchisq, computed via normal distribution and empirical distribution- nsamples
Number of bootstrap samples
- lcaiter
Number of LCA Iterations
Examples
## 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), nrow = 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
#> Bootstrap of LCA
#> ----------------
#>
#> Number of Bootstrap Samples: 3
#> Number of LCA Iterations/Sample: 5
#> Likelihood Ratio
#>
#> Mean: 110.9017
#> SDev: 157.1798
#> Value in Data Set: 1.904737
#> Z-Statistics: -0.6934543
#> P(Z>X): 0.7559878
#> P-Val: 1
#>
#> Pearson's Chisquare
#>
#> Mean: 118.9192
#> SDev: 170.239
#> Value in Data Set: 1.886384
#> Z-Statistics: -0.687462
#> P(Z>X): 0.7541042
#> P-Val: 1
#>