If 'compute' is FALSE (the default), then MxAlgebra expressions returns their current value as they have been computed by the optimization call (using mxRun). If the 'compute' argument is TRUE, then MxAlgebra expressions will be calculated in R. Any references to an objective function that has not yet been calculated will return a 1 x 1 matrix with a value of NA. Users will like this feature because it allows them to compare the result of algebraic expressions as computed by the back-end against those values computed by R. Developers will like this feature because we can compute all our algebra expressions before invoking the optimizer in order to check for any non-conformable matrices in our matrix operations (without having to explicitly check, R does the heavy lifting for us).

This provides an interesting function for testing before submitting a job. I am not sure that "compute" is the most intuitive argument name.

How about "R=TRUE"? Or "useR=TRUE"?

i get two different answers from

mxEval(C, fit)

mxEval(modelB.C, fit)

the set up is

This is not a bug. The named entity 'C' has the full name 'modelB.C'. You can use the short name 'C' only within the model 'modelB'. So the following produce identical results:

However when you call mxEval(C, fit) then 'fit' doesn't have an entity named 'C', but R does have a variable named C and so the R variable is returned when an entity is not found.

Use mxEval(...,show = TRUE) to see what is evaluated by mxEval().

Hi Michael,

I get the full name behavior, but I wonder whether returning non-OpenMx objects which are not in the model is the right behavior for a function call mxEval()...?

I think it would reduce scripting errors if mxEval(objName,model) returned an error when it couldn't find an object called objName in the model - as it stands instead of getting an error when they make a mistake, people will get results that they can misinterpret.

mxEval() is a convenience function that allows users to mix non-OpenMx entities with OpenMx entities to evaluate an arbitrary R expression. There's no way mxEval() should return an error when it can't find an object in the model. See ?mxEval for examples where non-OpenMx entities are mixed with OpenMx entities.

Gotcha: I 've only used in the simple "get this from the model" case.

cheers!,

t