I have question regarding which R-package to use to create a latent class/mixture model with both categorical and continuous indicator variables. I have not yet found a good example of this using R, even though there are a lot of mixture and latent class analysis packages in R. The software package Mplus have this capability and on the UCLA website there is an example of how to create such a model with Mplus (http://www.ats.ucla.edu/stat/mplus/seminars/introMplus_part2/lca.htm/ the second example).
The only way I have been able to replicate this example in R is using the depmixS4 package. Using the following code:
library(depmixS4) lca<-read.table("http://www.ats.ucla.edu/stat/mplus/seminars/introMplus_part2/lca.dat", sep=",") names(lca)<-c( "hm", "he", "voc", "nocol" ,"ach9", "ach10", "ach11","ach12") mod <- mix(list(hm~1,he~1,voc~1,nocol~1,ach9~1,ach10~1 ,ach11~1 ,ach12~1 ), data=lca, nstates=2, family=list(multinomial(),multinomial(),multinomial(),multinomial(), gaussian(),gaussian(),gaussian(),gaussian()), respstart=runif(32)) fmod<-fit(mod) summary(fmod)
This code seems to do the job of replicating the example with some minor differences between the output in the depmixS4 variant and the Mplus.
First, is this code correct for reproducing the Mplus example?
Second, does anyone have any other packages they would recommend when creating this type of model in R?