Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

Regarding question 2, another similar question here (Which R package to use to conduct a latent class growth analysis (LCGA) / growth mixture model (GMM)?) suggested OpenMx for "advanced structural equation modeling" in R. If it can be used to estimate growth mixture models, I'm betting it can be used to model a hybrid latent class/profile model. Haven't played with it myself yet though.

share|improve this answer
    
Thanks for the response. I looked at OpenMx but it seems to have a rather steep learning curve. I'll try to replicate the example with OpenMx when I get the time. Until then I think I will stick with depmixS4. –  Erik J Apr 10 '13 at 14:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.