You are here

Wrong algebra?

6 posts / 0 new
Last post
suzannejak's picture
Offline
Joined: 01/06/2010 - 06:17
Wrong algebra?

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((AA)%%(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

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
The parser translated your

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.

suzannejak's picture
Offline
Joined: 01/06/2010 - 06:17
Thanks for checking!

Thanks for checking!

suzannejak's picture
Offline
Joined: 01/06/2010 - 06:17
different solutions with the same fit

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

Ryne's picture
Offline
Joined: 07/31/2009 - 15:12
First, leaving the

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.

suzannejak's picture
Offline
Joined: 01/06/2010 - 06:17
I am very sorry about the

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.