I have prepared a script to compute a linear growth model to estimate genetic and environmental influences (ACE) in an intake and a slope with ordinal twin data: 4 variables, 3 categories (2 thresholds) in each of them. The sample is is divided in 6 groups (and so is the script), according to zygosity and sex: MZ men, DZ men, MZ women, DZ women, DZ man-woman and DZ woman-man.
I get an error message indicating the following sentence:
> Error: The algebra 'ACE.expThre' in model 'lgcOrdACE' generated the error message: length of 'dimnames'  not equal to array extent
The matrix concerning the error message ("expThre") is specified in the script as follows:
> mxMatrix( type="Full", nrow=1, ncol=nv, free=F, labels="th1", values=0, name="t1" ),
> mxMatrix( type="Full", nrow=1, ncol=nv, free=T, labels="th2", values=.1, name="t2" ),
> mxAlgebra( expression=(rbind(t1,t2)), name="Th" ),
> mxMatrix( type="Lower", nrow=nth, ncol=nth, free=FALSE, values=1, name="Inc" ),
> mxMatrix( type="Full", nrow=nv, ncol=nf, free=F, values=c(1,1,1,1,0,1,2,3), name="fl" ),
> mxMatrix( type="Unit", nrow=2, ncol=1, name="UnitV1" ),
> mxMatrix( type="Unit", nrow=1, ncol=nv, name="UnitV2" ),
> mxAlgebra( expression= (UnitV1 %x% (Inc %*% Th)) - (UnitV2 %x% (fl %*% Mean)), name="ThInc"),
> mxAlgebra( expression= cbind(ThInc,ThInc), dimnames=list(thRows,selVars), name="expThre" ),
I am not very familiar with scripting in OpenMx for growth models, so I am not able to understand the error and how can I correct it. I would very much appreciate any help to interpret the meaning of this error message. I have attached the full script with the model if anybody wish to have a look.
Thanks a lot in advance!
|Script.R ||7.32 KB|