Applying a definition variable to a factor mean

2 replies [Last post]
MNivard's picture
Joined: 12/09/2010

I have the following problem.

i estimated a single common factor model in twin pairs:

correlated factors within twinpairs, correlated residuals between measurements done at equal timepoints within twinpairs.

now i want to model the factor means by intoducing a definition variable.

i got the single factor twin model working, which essentially is a two factor model one factor for each twin. Now i need to introduce a definition variable that influences the factor mean. I have found some MX scripts for this but i need it to work in openMX.

How to go about this. I have read all help files on both the factor models and the definition variables but found no reference on definition variables related to factor mean moddeling.

neale's picture
Joined: 07/31/2009
I guess that you are using

I guess that you are using mxMatrix() calls, rather than mxPath()'s, to specify the model. With mxPath()'s it's pretty straightforward to put a definition variable (something of the form data.mydefvar) as a parameter name on a path from the reserved name "one" variable to a dummy variable and then another path (free) from the dummy variable to the factor.

It is pretty much the same sort of thing for the mxMatrix() specification, except that you need to specify that an element of a matrix is specified with a data.defvar label. The matrix algebra to get from the factor mean to the observed variables is basically one half of the predicted covariance statement, with a vector of factor means to multiply at the end.

mxAlgebra(alpha + beta * defVars, name = "M")
# Factor means equal m x 1 alpha plus m x p beta times p x 1 vector of definition variables defVars
# Note, beta matrix may be patterned with some zero cells (e.g., twin 1 factor 1 on def vars of twin 2) or twin 1 - twin 2 equalities

mxAlgebra(L %*% M, name = "obsMean")
# Observed means are factor loadings times factor means

Hope this is enough to get you started.

MNivard's picture
Joined: 12/09/2010
Never Mind, Problem solved!

Never Mind, Problem solved! thanks for the feedback!