# NOT RUN {
## Example 1.
## Model selection between two LCA models with different number of latent classes.
data(gss)
class2 = glca(item(ABDEFECT, ABHLTH, ABRAPE, ABPOOR, ABSINGLE) ~ 1,
data = gss, nclass = 2)
class3 = glca(item(ABDEFECT, ABHLTH, ABRAPE, ABPOOR, ABSINGLE) ~ 1,
data = gss, nclass = 3)
glca.gof(class2, class3)
# }
# NOT RUN {
glca.gof(class2, class3, test = "chisq")
# }
# NOT RUN {
glca.gof(class2, class3, test = "boot")
# }
# NOT RUN {
## Example 2.
## Model selection between two MLCA models with different number of latent clusters.
cluster2 = glca(item(ABDEFECT, ABHLTH, ABRAPE, ABPOOR, ABSINGLE) ~ 1,
group = REGION, data = gss, nclass = 3, ncluster = 2, na.rm = TRUE)
cluster3 = glca(item(ABDEFECT, ABHLTH, ABRAPE, ABPOOR, ABSINGLE) ~ 1,
group = REGION, data = gss, nclass = 3, ncluster = 3, na.rm = TRUE)
glca.gof(cluster2, cluster3)
# }
# NOT RUN {
glca.gof(cluster2, cluster3, test = "chisq")
# }
# NOT RUN {
glca.gof(cluster2, cluster3, test = "boot")
# }
# NOT RUN {
# }
# NOT RUN {
## Example 3.
## MGLCA model selection under the measurement (invariance) assumption across groups.
measInv = glca(item(ABDEFECT, ABHLTH, ABRAPE, ABPOOR, ABSINGLE) ~ 1,
group = SEX, data = gss, nclass = 3)
measVar = glca(item(ABDEFECT, ABHLTH, ABRAPE, ABPOOR, ABSINGLE) ~ 1,
group = SEX, data = gss, nclass = 3, measure.inv = FALSE)
glca.gof(measInv, measVar)
glca.gof(measInv, measVar, test = "chisq")
glca.gof(measInv, measVar, test = "boot")
# }
Run the code above in your browser using DataLab