You are here

How to set the value of a computed parameter to that computed value?

2 posts / 0 new
Last post
tbates's picture
Offline
Joined: 07/31/2009 - 14:25
How to set the value of a computed parameter to that computed value?

Is there a function to put the computed value of all parameters determined by a bracket address (e.g. var[1,1] ) into the appropriate values cell(s) in the model?

Background and use-case: OpenMx allows us to use labels to set the value of a parameter (matrix cell). Here's a RAM model where I insert the value of covXY into the row 2, column1 of the symmetric path (S) matrix:

m1$S
$labels
  x            y           
x "x_with_x"   "covXY[1,1]"
y "covXY[1,1]" "y_with_y"  
$values
         x        y
x 1.198632 0.000000
y 0.000000 2.018483

For summary and plot (in umx) the x-y covariance path is MIA. That zero should in fact be .97, as we can verify with mxEval(covXY[1,1], m1).

Now, I can mxEval the relevant parameters, and get the right answer, and even manually push this to the correct place. But is there an "update computed cells" function to do all this automatically?

tbates's picture
Offline
Joined: 07/31/2009 - 14:25
use mxEval or mxGetExpected over the matrices of interest

?mxEval has a "compute" option, which will save inputting the labels and mapping them out to where they were used. With this ( or ?mxGetExpected) , you can readily update cells with their computed values in the matrices you are interested in

mxGetExpected(model, component="means|covariance|thresholds")
mxEval(expression = A, model, compute=T)