Anybody knows how to specify a latent class model using FLXMRLMER in R?

#1
Hi Everyone,

I'm trying to use the package 'flexmix' in R to specify latent class models. I want to specify a model that has random effects. I looked up the flexmix package documents, and found that the function 'Flxmrlmer' could return a flexmix object that has random effects specified. However I don't really know how to do this appropriately, say I want to add some random effects of some variables, but when I tried to write "random=~1+x1+x2" in the function of 'Flxmrlmer', and use that in a function of 'flexmix'. It didn't give me the variances of each variables in each class. Instead it just returned something like 'sigma.variances=***xx', which I don't know is for which variable.

I searched and searched but did not found any example or detailed docs. Could anybody help me with that? Thanks.
 
#2
The results look like below:

> lcm1=flexmix(.~.|veh, model=FLXMRlmer(formula = chargedFlag ~ lastTripDummy + endsOnWeekend + endHome, random=~1+lastTripDummy+endsOnWeekend, weighted = FALSE), data=trips4,
+ control = list(minprior = 0.2), k=6)
> parameters(lcm1)
Comp.1
coef.(Intercept) 0.277952029
coef.lastTripDummy 0.288735866
coef.endsOnWeekend 0.005764304
coef.endHome 0.028378757
sigma2.Random1 0.031312085
sigma2.Random2 -0.024637386
sigma2.Random3 -0.007239830
sigma2.Random4 -0.024637386
sigma2.Random5 0.065117375
sigma2.Random6 0.010276826
sigma2.Random7 -0.007239830
sigma2.Random8 0.010276826
sigma2.Random9 0.006280905
sigma2.Residual 0.173414754
>
 
#3
Hi,
Why did you put "endHome" in the formula and not in the random part? I'm not sure but if "lastTripDummy", "endsOnWeekend", "endHome" are the fixed effects and "veh" the random effect, I think you should use this formula:
lcm1=flexmix(.~.|veh, model=FLXMRlmer(formula = chargedFlag ~ lastTripDummy + endsOnWeekend + endHome, random=~1, weighted = FALSE), data=trips4,
+ control = list(minprior = 0.2), k=6)

I'm not sure because I'm just starting with FLXMRlmer and because there is very few indication on this part