Error in MZ and DZ Expected Matrices

Attachment | Size |
---|---|
LGC Script.R | 8.65 KB |
I am working with the script I received at the workshop in Boulder earlier this year. I have altered the original script slightly to fit my data, but I am getting the following error messages in this section of my script:
#MZ AND DZ EXPECTED MATRICES
>
> # Algebra for expected Int & Slope means + sex effects (betas) for MZs
> mxModel("MZ",
+ mxData(data.frame(mzData,mzDefs), type="raw",) # Requests MZ definition variables: GENDER_1 & GENDER_2
+ mxMatrix( type="Full", nrow=1, ncol=1, free=FALSE, labels=c("data.GENDER_1"), name="GENDER_1"), # Selects GENDER_1 from mzDefs
Error: unexpected symbol in:
" mxData(data.frame(mzData,mzDefs), type="raw",) # Requests MZ definition variables: GENDER_1 & GENDER_2
mxMatrix"
> mxMatrix( type="Full", nrow=1, ncol=1, free=FALSE, labels=c("data.GENDER_2"), name="GENDER_2"), # Selects GENDER_2 from mzDefs
Error: unexpected ',' in " mxMatrix( type="Full", nrow=1, ncol=1, free=FALSE, labels=c("data.GENDER_2"), name="GENDER_2"),"
> #1X1 MATRIX OF THE TWINS SEX ABOVE FOR TWIN 1S SEX AND TWIN 2S SEX
> # Classic Mx means model=(F * (M+(sex_t1@Betas)))' | (F * (M+(sex_t2@Betas)))'
> mxAlgebra(expression=cbind( t(ACE.F %*% ( ACE.Mean + (GENDER_1 %x% ACE.Beta))),
+ t(ACE.F %*% ( ACE.Mean + (GENDER_2 %x% ACE.Beta))) ), name="expMean"),
Error: unexpected ',' in:
"mxAlgebra(expression=cbind( t(ACE.F %*% ( ACE.Mean + (GENDER_1 %x% ACE.Beta))),
t(ACE.F %*% ( ACE.Mean + (GENDER_2 %x% ACE.Beta))) ), name="expMean"),"
> mxFIMLObjective( covariance="ACE.expCovMZ", means="expMean", dimnames=selVars ) ),
Error: unexpected ')' in " mxFIMLObjective( covariance="ACE.expCovMZ", means="expMean", dimnames=selVars ) )"
I have attached the full script, and would greatly appreciate any assistance. Thanks very much!
Jamie
Hi, You have a function call
Hi,
You have a function call that has a trailing comma with no function argument after the comma.
Delete the trailing comma and that syntax error will be fixed.
Log in or register to post comments
In reply to Hi, You have a function call by mspiegel
This is such a popular error
This is such a popular error with new R and OpenMx users I almost wonder whether we should have a utility to scan for
). In bigger scripts it will be more tedious for even experts like mspiegel to spot. And this leads us to rethinking the OpenMx scripting style used in our documentation, which (as Greg Carey pointed out at a meeting in Seoul this year) makes debugging difficult. On the other hand, it does have the advantage of bypassing the pass-by-value issue, so at least we're not having to answer questions of that ilk.
",
Log in or register to post comments
So I guess we are not being
So I guess we are not being pre-parsed by ourselves, just parsed in R...
Maybe someone can suggest to the R core team that they make their error more helpful... i.e., mention that , ) might be a mistake not a missing parameter?
Log in or register to post comments