You are here

Revision of mxEval-help from Sat, 09/26/2009 - 08:49

Revisions allow you to track differences between multiple versions of your content, and revert back to older versions.

Wiki home page

Please add material here as you learn...

If you have questions not answers, then add those here: That's how a wiki works.

The purpose of mxEval() is to allow you to evaluate arbitrary R statements which may include data from inside a model.

mxEval() takes two essential parameters: the statement you want to evaluate, and a model in which to look for objects.

Optionally, you can include "compute=TRUE" to evaluate an OpenMx statement using R and "show=TRUE" to show where how mxEval translated your statement into full references to R and model objects

The simplest and most common use of mxEval is to extract a matrix from a model:

mxEval(M, model)
--> matrix M from model

note: If M is not found in the model, but an object called M exists in your R environment, mxEval will return that object. To avoid misleading results, use full object names, for instance, if the name of model is "model", this statement will only return M if model.M exists

mxEval(model.M, model)
--> matrix M from model

To refer to objects in submodels, use the submodel name

mxEval(mz.M+ dz.M, model)
--> sum of 'M' matrices found in submodels mz and dz

You can also do algebra and arithmetic inside mxEval, so this works:
mxEval(2 %x% M, model)
--> 2.M