Wrong algebra?

Posted on
Picture of user. suzannejak Joined: 01/06/2010
I'm sorry if this is a too specific question, I tried to use the Python parser but I am totally unfamiliar with Python and can't get it working.

I keep finding differences between my Mx and OpenMx analysis and I think I must have made a mistake in translating the following algebra:

in Mx:

G = (Y-X)@(A.((A.A)*(V-J))) + X@(A.((U-I)*(A.A)));

in OpenMx (wrong?):

algebraG = mxAlgebra(expression = (Y-X) %x% (A*((A*A)%*%(V-J))) + X %x% (A * ((U-I)%*%(A*A))), name = "G")

Does anyone of you check whether this is correct or not? I hope so, thanks in advance,

Suzanne

Replied on Tue, 01/03/2012 - 08:43
Picture of user. mspiegel Joined: 07/31/2009

The parser translated your algebra into

(Y - X) %x% ((A * (((A * A)) %*% (V - J)))) + X %x% ((A * ((U - I) %*% ((A * A)))))

Assuming there is no bug in the Mx/OpenMx algebra parser, it looks like a match to what you've written.

Replied on Mon, 01/09/2012 - 11:07
Picture of user. suzannejak Joined: 01/06/2010

In reply to by suzannejak

Thanks again for checking the algebra! Apparently something else is wrong when fitting this model. Only, I do not get what it is.

I am translating an Mx script for exploratory factor analysis (with oblique rotation) to openMx. So I have the right solution from Mx.

In openMx, I obtain the same fit as with Mx, but different parameter estimates depending on the startvalues. When I use -.1 as startvalues for factor correlations (matrix F) I get the same solution as with Mx. However, if I use 0, I get another solution (but still the same fit).

I attached my openMX script and the old Mx script, in case you want to take a look. Thanks in advance!

Suzanne

Replied on Mon, 01/09/2012 - 21:06
Picture of user. Ryne Joined: 07/31/2009

In reply to by suzannejak

First, leaving the 'rm(list=ls(all=TRUE))' line in your script is just sneaky. Not quite as sneaky as when someone passed around an OpenMx script that set the variable 'F' to be equal to 'TRUE', but still pretty sneaky.

The two different sets of results go a bit deeper than the loadings, as the factor correlations vary across models and the D matrix includes a negative value in the second optimization (though the latter doesn't matter in your code). I think this is just a case of the rotation not working the way its supposed to. My (admittedly weak) understanding of the algebra behing exploratory factor analysis and rotation is that it is traditionally a two-step procedure, where rotation is a method for picking one of any number of models that fit equally well. In a single-step procedure, OpenMx could feasibly get a correct minimum for the model but a local minimum for the rotation. I don't know enough about how rotation is handled in other programs to give you a clearer answer.

Replied on Tue, 01/10/2012 - 08:10
Picture of user. suzannejak Joined: 01/06/2010

In reply to by Ryne

I am very sorry about the 'rm(list=ls(all=TRUE))'. I didn't realize it, but now I see that sending a script with this line to others is a bit like throwing a hand grenade to your work. I promiss I will not do it again!

The script indeed uses the single-step procedure described by Oort (2010), who used Mx. The weird thing is that in Mx it is all fine, but it seems that in openMx the rotation constraint is not working as it should.

This is the paper from Oort:
Oort, F.J. (2010). Likelihood based confidence intervals in exploratory factor analysis. Structural Equation Modeling, 18, 383-396.