Tue, 01/26/2010 - 19:57

Hello,

I am delighted that OpenMx is now available for SEM and I am working my way through the tutorials. However, one of my students has a slightly different two factor model setup to that shown in the tutorial and i am trying to modify the 2 factor example accordingly, but I am getting a bit stuck with the setup ...

In particular, I am trying to modify the two factor model given on this page http://openmx.psyc.virginia.edu/docs/OpenMx/latest/FactorAnalysis_Path.html so that, in terms of the RAM diagram, i do not have a 2 headed arrow to and from F1 to F2, but instead just have a single headed arrow from F1 to F2.

Also I would like to obtain a measure of the covariance (or correlation) of F1 and F2 to show how strongly they are related.

To achieve this, I assume I have to modify this section of mxPath:

# latent variances and covariance

mxPath(

from=c("F1","F2"),

arrows=2,

all=TRUE,

free=TRUE,

values=c(1, .5,.5, 1),

labels=c("varF1","cov","cov","varF2")

to something like:

# latent variances and covariance

mxPath(

from=c("F1"),

to=c("F2"),

arrows=1,

all=TRUE,

free=TRUE,

values=c(1),

labels=c("F1onF2")

however, whilst the model runs fine with this spec i am getting a bit lost with the output. In particular, how can I see how strongly F1 and F2 are related?

Any advice?

Thanks,

Mark.

Mark,

The two ways of specifying the model you describe are exactly equivalent with regards to fit; all you are doing is describing the relationship between the two factors in two different ways.

In the version in the tutorial, a single mxPath statement specifies the variances of the first factor, the variance of the second factor, and the covariance between them. When "arrows=2" and the "to" argument is left blank, arrows go from the variables in the "from" argument back to the variables in the "from" argument. My specifying "all=TRUE", four paths are created: one from F1 to F1 (its variance), one from F1 to F2 (the covariance between them), one from F2 to F1 (redundant with the previous path; it actually replaces the previous one), and one from F2 to F2 (its variance). You could easily create three separate mxPath statements to do the same thing, but that would be three times as much typing.

The way you're choosing to specify the factor model is the same, but you're describing the covariance between F1 and F2 as a regression. The code you gave is exactly right, although the "all=TRUE" argument doesn't do anything if there is only one variable in the "from" and "to" arguments. You'll still have to specify the factor variances somehow. I would suggest something like this:

#The regression:

mxPath(from="F1",

to="F2",

arrows=1,

free=TRUE,

values=1,

labels="F1onF2"

)

#The factor variances:

mxPath(from=c("F1","F2"),

arrows=2,

free=TRUE,

values=1,

labels=c("varF1", "varF2")

)

Glad you're so happy with OpenMx so far.

-Ryne