Returned matrices (expCov, expMean, A,S, etc) only reflect last row of data
Posted on

Hi folks. I mentioned this to Joshua who asked me to post it here for further input. While wondering about some strange output in one of my functions the other day I discovered that the matrices output by openmx only reflect the last calculated row of data. I believe this only becomes evident when definition variables are used, such that the A S or M matrices (when using RAM format, though I don't believe it's limited to this case) depend on the definition variable. I think a better option may be some sort of weighted output based on the number of observations in each row...
Correct; what would you prefer?
Could you further describe the behavior you'd prefer to see from OpenMx in this regard?
Log in or register to post comments
In reply to Correct; what would you prefer? by RobK
Ok. For the sorts of models
Log in or register to post comments
In reply to Ok. For the sorts of models by CharlesD
covariance extraction
Log in or register to post comments
In reply to covariance extraction by jpritikin
oh, mxEval
Log in or register to post comments
In reply to oh, mxEval by jpritikin
Just for info: I couldn't
Log in or register to post comments
?mxEval
It is a design feature to leave the matrices and algebras at their last computed state. You're right that it is general to any model, not just RAM models. Definition variables could be used for many things in many different ways . Thus, OpenMx does not presume to know how you might want matrices or algebras printed. We just leave them in their last computed form. A weighted combination might make sense for your use case, but be meaningless or misleading in others' cases.
The summary() function gives you a nice report of the estimated parameters. And mxEval() can be used to get the computed form of any matrix or algebra for any row of data.
AModel <- mxmodel(...)
ARun <- mxRun(AModel) #Model with definition variables
mxEval(AMatrixOrAlgebra, model=ARun, compute=TRUE, defvar.row=14)
# result/values of AMatrixOrAlgebra from model ARun at definition variable row 14.
Log in or register to post comments