You are here

Univariate Ordinal ACE question

1 post / 0 new
Hilton28's picture
Offline
Joined: 07/16/2020 - 18:34
Univariate Ordinal ACE question

Hello,

I am brand new to running univariate ordinal ACE models and am running into an error that I could use some help with.

Here is the code I am running:

Specify and Run Saturated Model (Tetrachoric correlations) with RawData and Matrix-style Input

-----------------------------------------------------------------------

clu1SatModel <- mxModel("twinSat",
mxModel("MZ",
# Matrix & Algebra for expected means vector (SND), Thresholds and correlation
mxMatrix( type="Zero", nrow=1, ncol=nv, name="M" ),
mxAlgebra( expression= cbind(M,M), name="expMean" ),
mxMatrix(type="Full", nrow=1, ncol=ntv, free=TRUE, values=.4, name="expThreMZ", dimnames=list('th1',selVars) ),
mxMatrix(type="Stand", nrow=2, ncol=2, free=T, values=.2, lbound=-.99, ubound=.99, name="expCorMZ"),
mxData(mzData, type="raw"),
mxExpectationNormal( covariance="expCorMZ", means="expMean", dimnames=selVars, thresholds="expThreMZ" )),

mxModel("DZ",

# Matrix & Algebra for expected means vector (SND), Thresholds and correlation
mxMatrix( type="Zero", nrow=1, ncol=nv, name="M" ),
mxAlgebra( expression= cbind(M,M), name="expMean" ),
mxMatrix( type="Full", nrow=1, ncol=ntv, free=TRUE, values=.4, name="expThreDZ", dimnames=list('th1',selVars)),
mxMatrix(type="Stand", nrow=2, ncol=2, free=T, values=.2, lbound=-.99, ubound=.99, name="expCorDZ"),
mxData(dzData, type="raw"),
mxExpectationNormal( covariance="expCorDZ", means="expMean", dimnames=selVars, thresholds="expThreDZ" )),
mxAlgebra(MZ.objective + DZ.objective, name="2sumll" ),
mxFitFunctionML()

)
clu1SatFit <- mxRun(clu1SatModel)

The last line (clu1SatFit) returns the following error message:
Error: The references 'MZ.fitfunction' and 'DZ.fitfunction' are unknown in the algebra named 'twinSat.2sumll'
In addition: Warning messages:
1: In is.na(x) : is.na() applied to non-(list or vector) of type 'symbol'
2: In is.na(x) : is.na() applied to non-(list or vector) of type 'symbol'
>

I've played around with trying to define MZ.fitfunction and DZ.fitfunction in a few places but have not found success yet.
Thanks in advance!