# \donttest{
# fit standard latent class
hivtests.lca2 <- randomLCA(hivtests[, 1:4], freq = hivtests$freq, cores = 1)
# with random effect and constant loading
hivtests.lca2random <- randomLCA(hivtests[, 1:4], freq = hivtests$freq, random = TRUE,
quadpoints = 101, penalty = 1.0, cores = 1)
# with random effect and variable loading
# for this model there are 13 parameters fitted to 16 observations, so model is fairly unstable
hivtests.lca2random2 <- randomLCA(hivtests[, 1:4], freq = hivtests$freq, random = TRUE,
constload = FALSE, quadpoints = 101, penalty = 1.0, cores = 1)
# BIC shows best model is random effects with constant loading
print(c(BIC(hivtests.lca2), BIC(hivtests.lca2random), BIC(hivtests.lca2random2)))# }
Run the code above in your browser using DataLab