mxEval

2 replies [Last post]
pgseye's picture
Offline
Joined: 10/13/2009

Hi,

I'm doing something wrong when trying to use mxEval to inspect values. Part of the bivariate script I'm running is below. It outputs estimates accordingly (only copied the first couple). But when I try mxEval after running the model, I get the starting value:

> mxEval(ACE.a[1,1],multiCholACEModel,T,T)
multiCholACEModel[["ACE.a"]]@values[1, 1, drop = FALSE]
[,1]
[1,] 0.5

Can someone tell me what I'm doing wrong?

Many thanks and Happy Easter to all.

Paul

name matrix row col Estimate Std.Error
1 a11 ACE.a 1 1 -31.296561 1.3084660
2 a21 ACE.a 2 1 -30.571559 1.3231659

meanSVnv <- c(540,540)
cholSVnv <- c(.5,0,.5)
AFac <- c(
"a11","a21",
"a22"
)
CFac <- c(
"c11","c21",
"c22"
)
EFac <- c(
"e11","e21",
"e22"
)
multiCholACEModel <- mxModel("multiCholACE",
mxModel("ACE",
# Matrices a, c, and e to store a, c, and e path coefficients
mxMatrix( type="Lower", nrow=nv, ncol=nv, free=TRUE, values=cholSVnv, labels=AFac, name="a" ),
mxMatrix( type="Lower", nrow=nv, ncol=nv, free=TRUE, values=cholSVnv, labels=CFac, name="c" ),
mxMatrix( type="Lower", nrow=nv, ncol=nv, free=TRUE, values=cholSVnv, labels=EFac, name="e" ),
# Matrices A, C, and E compute variance components
mxAlgebra( expression=a %*% t(a), name="A" ),
mxAlgebra( expression=c %*% t(c), name="C" ),
mxAlgebra( expression=e %*% t(e), name="E" ), ...

mspiegel's picture
Offline
Joined: 07/31/2009
I'm guessing the model was

I'm guessing the model was run with a function call that looks something like:
multiCholACEFit <- mxRun(multiCholACEModel)

In that case you need to use mxEval(ACE.a[1,1],multiCholACEFit)

pgseye's picture
Offline
Joined: 10/13/2009
Thanks Michael, I thought it

Thanks Michael,

I thought it was something simple - silly error.

Regards,

Paul