mxEval

Posted on
Picture of user. tbates Joined: 07/31/2009

Topic for discussing mxEval

Replied on Sun, 08/23/2009 - 21:57
Picture of user. tbates Joined: Jul 31, 2009

Should mxEval() pass through the dimNames of algebra results?

if I
mxEval(expCovMZ, twinACEFit)

I get a matrix, but without names

They were set on the algebra
mxAlgebra(rbind (cbind(A+C+E , A+C),
cbind(A+C , A+C+E)), dimnames = list(selVars, selVars), name="expCovMZ"),

And are in the model Fit:

twinACEFit@algebras$expCovMZ
mxAlgebra 'expCovMZ'
@formula: rbind(cbind(A + C + E, A + C), cbind(A + C, A + C + E))
@result:
[,1] [,2] [,3] [,4]
[1,] 0.790535801 -0.004704324 0.617627914 -0.001694689
[2,] -0.004704324 0.004559813 -0.001694689 0.004015630
[3,] 0.617627914 -0.001694689 0.790535801 -0.004704324
[4,] -0.001694689 0.004015630 -0.004704324 0.004559813
dimnames:
[[1]]
[1] "bmi1" "ht1" "bmi2" "ht2"

[[2]]
[1] "bmi1" "ht1" "bmi2" "ht2"

Replied on Mon, 08/24/2009 - 10:51
Picture of user. tbates Joined: Jul 31, 2009

In reply to by Steve

Tangentially, I remain confused about why the matrix examples print out no fit statistics... is that a bug, or on the to-do list, or left to the user to figure out?

reduction: run trunk/demo/UnivariateTwinAnalysis_MatrixRaw.R

> summary(twinAEFit)
  name    matrix row col parameter estimate error estimate
1 mean expMeanMZ   1   1         21.3929339       53.45028
2    a         X   1   1          0.7856859       71.82837
3    e         Z   1   1          0.4159882      110.59854

Observed statistics:  0 
Estimated parameters:  3 
Degrees of freedom:  -3 
AIC:  
BIC:  
adjusted BIC: 
RMSEA:  

Oh-yes, also, adjusted-BIC is not printed for a simple factor model.

require(OpenMx)
data(demoOneFactor)
manifests <- names(demoOneFactor)
latents <- c("G")
factorModel <- mxModel("One Factor", type="RAM",
+       manifestVars = manifests,
+       latentVars = latents,
+       mxPath(from=latents, to=manifests),
+       mxPath(from=manifests, arrows=2),
+       mxPath(from=latents, arrows=2,
+             free=F, values=1.0),
+       mxData(cov(demoOneFactor), type="cov",
+             numObs=500))
summary(mxRun(factorModel))
...
Observed statistics:  15 
Estimated parameters:  10 
Degrees of freedom:  5 
AIC:  -3658.281 
BIC:  -1839.677 
adjusted BIC: 
RMSEA:  0.03088043