Will Open Mx be able to deal with such problem.I am in the begining of a PHD and I apm looking for a software to test such problem, being familiar with R and on mac os X I was wondering if OpenMx was an option ?Thank you for this work.Guillaume Avenin

Categorical latent variable modeling is in the works. Two of our core developers have a plan and are currently working on it, and I'm sure they would appreciate testing when the time comes, if you were interested. With regards to longitudinal studies, as long as your two interests are mutually exclusive, you should be able to model longitudinal data in OpenMx using standard techniques. But, if you are interested in GMMs or LTA, then my first comment applies.

Thank you for this answer, your first comment answered precisely to my interogation and I would be very glad to be some help.Actually I will pursue the exploration of this beautifull software (R extension), and hope be able to model longitudinal data with continuous variables also.

Hi Jeff,

I have two questions concerning latent class analysis (LCA) and latent transition analysis (LTA), respectively.

and tried to replicate the results of ex7.3 on Mplus 7 manual(without auxiliary statement). The class membership probabilities for each latent class were consistent between OpenMx and Mplus, however, I noticed that the number of parameter that OpenMx and Mplus estimated were different, 10 vs. 9. A closer look at the results showed that the parameters the two packages estimated are:

OpenMx: 8 thresholds of indicators+2 class membership probabilities=10 parameters.

Mplus: 8 thresholds of indicators+1 mean of c#1=9 parameters

(Mplus also estimated the 2 class membership probabilities, but these 2 seems not in the 9 parameters).

So how can I estimate the mean of c#1? Besides, the standard error I got for the estimates are NA. How to get the standard error? and is it possible to include auxiliary variables in openmx?

Here is what I have so far (the model did not converge):

> c11=mxModel('c11',

+ mxMatrix(type='Iden',name='r',nrow=5,ncol=5,byrow=T,free=F),

+ mxMatrix(type='Full',name='m',nrow=1,ncol=5,byrow=T,free=F),

+ mxMatrix(type='Full',name='c1thrshd',nrow=1,ncol=5,byrow=T,free=T),

+ mxFIMLObjective(covariance='r',means='m',thresholds='c1thrshd',dimnames=names(ltadat1[,1:5]),vector=T)

+ )

> c12=mxModel('c12',

+ mxMatrix(type='Iden',name='r',nrow=5,ncol=5,byrow=T,free=F),

+ mxMatrix(type='Full',name='m',nrow=1,ncol=5,byrow=T,free=F),

+ mxMatrix(type='Full',name='c2thrshd',nrow=1,ncol=5,byrow=T,free=T),

+ mxFIMLObjective(covariance='r',means='m',thresholds='c2thrshd',dimnames=names(ltadat1[,1:5]),vector=T)

+ )

> c13=mxModel('c13',

+ mxMatrix(type='Iden',name='r',nrow=5,ncol=5,byrow=T,free=F),

+ mxMatrix(type='Full',name='m',nrow=1,ncol=5,byrow=T,free=F),

+ mxMatrix(type='Full',name='c3thrshd',nrow=1,ncol=5,byrow=T,free=T),

+ mxFIMLObjective(covariance='r',means='m',thresholds='c3thrshd',dimnames=names(ltadat1[,1:5]),vector=T)

+ )

> c21=mxModel('c21',

+ mxMatrix(type='Iden',name='r',nrow=5,ncol=5,byrow=T,free=F),

+ mxMatrix(type='Full',name='m',nrow=1,ncol=5,byrow=T,free=F),

+ mxMatrix(type='Full',name='c1thrshd',nrow=1,ncol=5,byrow=T,free=T),

+ mxFIMLObjective(covariance='r',means='m',thresholds='c1thrshd',dimnames=names(ltadat1[,6:10]),vector=T)

+ )

> c22=mxModel('c22',

+ mxMatrix(type='Iden',name='r',nrow=5,ncol=5,byrow=T,free=F),

+ mxMatrix(type='Full',name='m',nrow=1,ncol=5,byrow=T,free=F),

+ mxMatrix(type='Full',name='c2thrshd',nrow=1,ncol=5,byrow=T,free=T),

+ mxFIMLObjective(covariance='r',means='m',thresholds='c2thrshd',dimnames=names(ltadat1[,6:10]),vector=T)

+ )

> c23=mxModel('c23',

+ mxMatrix(type='Iden',name='r',nrow=5,ncol=5,byrow=T,free=F),

+ mxMatrix(type='Full',name='m',nrow=1,ncol=5,byrow=T,free=F),

+ mxMatrix(type='Full',name='c3thrshd',nrow=1,ncol=5,byrow=T,free=T),

+ mxFIMLObjective(covariance='r',means='m',thresholds='c3thrshd',dimnames=names(ltadat1[,6:10]),vector=T)

+ )

> c1toc2=mxModel('c1toc2trans',

+ mxMatrix(type='Full',name='tr',nrow=3,ncol=3,values=c(1,1,1,1,1,1,1,1,1),byrow=T,free=T)

+ )

> ltamodel=mxModel('ltamodel',c11,c12,c13,c21,c22,c23,c1toc2,mxData(ltadat1[,1:10],type='raw'),

+ mxMatrix('Full',name='c1memprob',nrow=3,ncol=1,byrow=T,free=T,labels=c('c11prob','c12prob','c13prob')),

+ mxMatrix('Full',name='c2memprob',nrow=3,ncol=1,byrow=T,free=T,labels=c('c21prob','c22prob','c23prob')),

+ mxBounds(c('c11prob','c12prob','c13prob','c21prob','c22prob','c23prob'),0,1),

+ mxAlgebra(sum(c1memprob),name='c1p'),

+ mxAlgebra(sum(c2memprob),name='c2p'),

+ mxConstraint(c1p==1),

+ mxConstraint(c2p==1),

+ mxAlgebra(-2*sum(log(c11prob%x%c11.objective+c12prob%x%c12.objective+c13prob%x%c13.objective+c21prob%x%c21.objective+c22prob%x%c22.objective+c23prob%x%c23.objective)),name='lta'),

+ mxAlgebraObjective('lta')

+ )

> model=mxRun(ltamodel)

Running ltamodel

Warning message:

In model 'ltamodel' NPSOL returned a non-zero status code 1. The final iterate satisfies the optimality conditions to the accuracy requested, but the sequence of iterates has not yet converged. NPSOL was terminated because no further improvement could be made in the merit function (Mx status GREEN).

> summary(model)

Thank you very much.

What you have may work but it isn't very efficient. This is because OpenMx will use multidimensional integration over 5 dimensions, but the covariance matrix is an identity matrix. Classic Mx would detect such independence, but OpenMx does not yet do that.

I'm not an Mplus expert, but from looking at the manual online it seems that there is another variable in the dataset which gives an observed class for two groups. The model seems to specify that the groups differ with respect to the mean of the latent variable. In OpenMx this could be achieved by a definition variable for group, read in with the data (like x in the Mplus script) or by a multiple group approach. I am thinking that the group variable might be simpler - code x 0/1 and then put in a group mean algebra of the form:

and then change

to

To get the standard errors, you probably have to get rid of any mxConstraint being used. This is pretty easy for class membership probabilities, one can simply fix one of them to 1.0 and then make an algebra to divide them by their sum, along these lines:

I have a regime switching growth curve model paper submitted to Psych Methods, which probably does quite a bit of what you want. I could share a draft with you if that would help.

Dear Neale,

Thank you very much for replying.

You are correct. The openmx code I have now does not include the binary covariate. I was in the first step of trying, just want to see if the model works (apparently something went wrong).

Could you share the draft and maybe some example code for the regime switching model please? That would be very helpful.

Thank you very much