How does one make the variance estimates a function of the definition variable sex? I am working on a univariate script with two groups, MZ and DZ, with opposite sex twins included in the DZ group. I have tried to apply principles from the moderator script from Boulder, but I'm not sure if that is OK for the definition variable case. The script below fails due to inconformable arrays, and I am working on getting the matrices in the right format, but I need to know whether I am on the right track here. Very grateful for any help to get some steps further.
mxModel("DZ", mxData( observed=dzData, type="raw" ),
Matrix for definition variable
mxMatrix( type="Full", nrow=2, ncol=1, free=F, label=c("data.ASEX","data.ASEX"), name="DZDefVars"),
Algebra for making the means a function of the definition variable sex
mxAlgebra( expression=twinADE.expMean + twinADE.beta %*% DZDefVars, name="expMeanDZMod"),
Algebra for making the variance estimates a function of the definition variable sex
mxAlgebra( expression=(twinADE.a+ DZDefVars%%twinADE.aI) %% t(twinADE.a+ DZDefVars%%twinADE.aI), name="A" ),
mxAlgebra( expression=(twinADE.d+ DZDefVars%%twinADE.dI) %% t(twinADE.d+ DZDefVars%%twinADE.dI), name="D" ),
mxAlgebra( expression=(twinADE.e+ DZDefVars%%twinADE.eI) %% t(twinADE.e+ DZDefVars%*%twinADE.eI), name="E" ),
Algebra for expected variance/covariance matrix and expected mean vector in DZ
mxFIMLObjective( covariance="twinADE.expCovDZ", means="expMeanDZMod", dimnames=selVars )
.