You are here

Correlated Factors Sex limitation model

6 posts / 0 new
Last post
koak's picture
Offline
Joined: 05/10/2012 - 23:13
Correlated Factors Sex limitation model

Hello

I downloaded from the OpenMX website the correlated factors sex limitation model, and amended it for our data (removing the opposite sex components as our twins are all same sex).

The script runs and converges but there is no output (seeming that it is not fitting). There are no warning messages and no error messages. The output we get is:

observed statistics: 4500
estimated parameters: 0
degrees of freedom: 4500
-2 log likelihood: NA
saturated -2 log likelihood: NA
number of observations: 750
chi-square: NA
p: NA
AIC (Mx): NA
BIC (Mx): NA
adjusted BIC:
RMSEA: NA
timestamp: 2013-11-15 09:54:40
frontend time: 9.456 secs
backend time: 0.125 secs
independent submodels time: 0 secs
wall clock time: 9.581 secs
cpu time: 9.581 secs
openmx version number: 1.0.7-1706

A number of us have looked at this, and just can't work out where the glitch is.

The data and script are attached.

Thank you so much for any assistance in advance!

Karen

neale's picture
Offline
Joined: 07/31/2009 - 15:14
Definition variable problem?

Running the 2.0 alpha, I got this error message:

> ACENonScSLCoraFit <- mxRun(ACENonScSLCoraModel)
Running ACENonScSLCora 
Error: The definition variable 'MZm.data.AgeA' in matrix 'MZm.obs_age' refers to a data set that does not contain a column with name 'AgeA'

which may be the problem.

koak's picture
Offline
Joined: 05/10/2012 - 23:13
Correct data set actually attached this time

Hello Mike
I stupidly posted a copy of the data set without the Age variables. The correct data set is now attached.

I double checked this with the data I am using and all variables definitely come up, and MZm is calculating obs_age and the subsequent expected means which require it to be there.

I would really appreciate any further assistance in trying to get this model to fit.

Many thanks

Karen

neale's picture
Offline
Joined: 07/31/2009 - 15:14
Oooh so much pain from one misplaced parenthesis

In some ways this is an object lesson in why the piecewise approach to scripting (make a bunch of R objects and then stick them together in an mxModel() statement) is better. It also says something about the "special" nature of the top level model of mxModels.

What happened was that this code

ACENonScSLCoraModel <- mxModel("ACENonScSLCora",
        mxModel("ACE",

effectively made a lower level model ACE. This would be fine, except that the algebra to combine the fit functions of the mzm, dam etc. groups, was in in the ACE model, and not the top level model as required for it to be recognized as something to optimize. So the end of the script:

 mxModel("DZf", 
#matrix for the observed age
    mxMatrix(  type="Full", nrow=1, ncol=2, free=FALSE, label=c("data.AgeA", "data.AgeB"), name="obs_age"  ), 
#matrix for the observed Education
    mxMatrix(  type="Full", nrow=1, ncol=2, free=FALSE, label=c("data.EducationA", "data.EducationB"), name="obs_edu"  ), 
 
#Algebra to add covariates to mean
    mxAlgebra( expression= ACE.expMeanf + ACE.b_age %x% obs_age + ACE.b_edu %x% obs_edu      , name="expMeanfDZ" ),        
 
        mxData( observed=dzfData, type="raw" ),
        mxFIMLObjective( covariance="ACE.expCovDZf", means="expMeanfDZ", dimnames=selVars ) ),
    mxAlgebra( expression=MZm.objective + DZm.objective + MZf.objective + DZf.objective , name="modelfit" ),
    mxAlgebraObjective("modelfit")
 ) )

needed to be modified to be:

... as before then
                mxData( observed=dzfData, type="raw" ),
            mxFIMLObjective( covariance="ACE.expCovDZf", means="expMeanfDZ", dimnames=selVars ) ) ),
 
            mxAlgebra( expression=MZm.objective + DZm.objective + MZf.objective + DZf.objective , name="modelfit" ),
            mxAlgebraObjective("modelfit")
 #, mxCI (c('ACE.VarComp'))
)

This puts the mxAlgebra() at the end in the top level model. A similar fix would have been to skip the whole top-level model and just start with the ACE bit (and remove a parenthesis at the end).

Sorry it took me so long to figure this out. Thanks for your patience!

koak's picture
Offline
Joined: 05/10/2012 - 23:13
Thank you so much for going through that pain

Hello Mike

Thank you so very, very much for subjecting yourself to all that pain for a nasty parenthesis!

I so very much appreciate it.

Karen

neale's picture
Offline
Joined: 07/31/2009 - 15:14
It's not you, it's us :)

The behavior was definitely odd. No parameters affected the fit function, so the Optimizer just exited without doing anything. However, the script looked like it should be fine. We should probably issue a warning in such instances.

Also, I note that although everything looks ok inside the fitted model (estimates, fit function etc), summary() doesn't work in the v 2.0 beta, so I'll report a bug on that front.