Error in MxConstraint after updating to OpenMx 0.3.0

2 replies [Last post]
trinewa's picture
Offline
Joined: 11/30/2009

I have just installed the OpenMx version 3.0.3, and corrected the MxConstraint in my multivariate script.
I keep getting error messages when running the MxConstraint in the new script.
Anyone who can help me getting this part of the script right?

# Fit Multivariate Model with Equal Means & Variances across Twin Order and Zygosity
# -----------------------------------------------------------------------
# Constrain expected means and variances to be equal across twin order
equateMeansVarsTwinModel <- mxModel(multiTwinSatFit, name="equateMeansVarsTwin",
mxConstraint( alg1=MZ.ExpVarMZt1 == alg2=MZ.ExpVarMZt2, name="VarMZt1eqt2"),
mxConstraint( alg1=DZ.ExpVarDZt1 == alg2=DZ.ExpVarDZt2, name="VarDZt1eqt2"),
mxConstraint( alg1=MZ.ExpMeanMZt1 == alg2=MZ.ExpMeanMZt2, name="MeanMZt1eqt2"),
mxConstraint( alg1=DZ.ExpMeanDZt1 == alg2=DZ.ExpMeanDZt2, name="MeanDZt1eqt2")
)
equateMeansVarsTwinFit <- mxRun(equateMeansVarsTwinModel)
equateMeansVarsTwinSumm <- summary(equateMeansVarsTwinFit)
equateMeansVarsTwinSumm
parameterSpecifications(equateMeansVarsTwinFit)
tableFitStatistics(multiTwinSatFit, equateMeansVarsTwinFit)
expectedMeansCovariances(equateMeansVarsTwinFit)

These are the error messages I get :
equateMeansVarsTwinModel <- mxModel(multiTwinSatFit, name="equateMeansVarsTwin",
+ mxConstraint( alg1=MZ.ExpVarMZt1 == alg2=MZ.ExpVarMZt2, name="VarMZt1eqt2"),
Error: unexpected '=' in:
"equateMeansVarsTwinModel <- mxModel(multiTwinSatFit, name="equateMeansVarsTwin",
mxConstraint( alg1=MZ.ExpVarMZt1 == alg2="
mxConstraint( alg1=DZ.ExpVarDZt1 == alg2=DZ.ExpVarDZt2, name="VarDZt1eqt2"),
Error: unexpected '=' in " mxConstraint( alg1=DZ.ExpVarDZt1 == alg2="
mxConstraint( alg1=MZ.ExpMeanMZt1 == alg2=MZ.ExpMeanMZt2, name="MeanMZt1eqt2"),
Error: unexpected '=' in " mxConstraint( alg1=MZ.ExpMeanMZt1 == alg2="
> mxConstraint( alg1=DZ.ExpMeanDZt1 == alg2=DZ.ExpMeanDZt2, name="MeanDZt1eqt2")
Error: unexpected '=' in " mxConstraint( alg1=DZ.ExpMeanDZt1 == alg2="
> )
Error: unexpected ')' in ")"
> equateMeansVarsTwinFit <- mxRun(equateMeansVarsTwinModel)
Error in cat("Running", model@name, "\n") :
object 'equateMeansVarsTwinModel' not found

mspiegel's picture
Offline
Joined: 07/31/2009
Use: mxConstraint(MZ.ExpVarMZ

Use:

mxConstraint(MZ.ExpVarMZt1 == MZ.ExpVarMZt2, name="VarMZt1eqt2")<code>
 
instead of:
 
<code>mxConstraint( alg1=MZ.ExpVarMZt1 == alg2=MZ.ExpVarMZt2, name="VarMZt1eqt2")

trinewa's picture
Offline
Joined: 11/30/2009
Thank you!

Thank you!