mxAlgebra {OpenMx}R Documentation

Function To Create MxAlgebra Object

Description

This function creates a new MxAlgebra object.

Usage

mxAlgebra(expression, name = NA, dimnames = NA)

Arguments

expression An R expression of matrix operators and matrix functions.
name An optional character string indicating the name of the object.
dimnames list. The dimnames attribute for the algebra: a list of length 2 giving the row and column names respectively. An empty list is treated as NULL, and a list of length one as row names. The list can be named, and the list names will be used as names for the dimensions.

Details

The mxAlgebra function is used to create algebraic expressions that operate on one or more MxMatrix objects. To evaluate an MxAlgebra object, it must be placed in an MxModel object, along with all referenced MxMatrix objects and the mxAlgebraObjective function. The mxAlgebraObjective function must reference the MxAlgebra object to be evaluated by name.

The following operations are supported in mxAlgebra:

The following functions are supported in mxAlgebra:

Value

Returns a new MxAlgebra object.

References

The OpenMx User's guide can be found at http://openmx.psyc.virginia.edu/documentation.

See Also

MxAlgebra for the S4 class created by mxAlgebra. MxMatrix and mxMatrix for objects which may be entered in the 'expression' argument and the function that creates them. More information about the OpenMx package may be found here.

Examples


# the algebra B evaluates to the matrix A
A <- mxMatrix("Full", nrow = 3, ncol = 3, name = "A")
B <- mxAlgebra(A, name = "B")

# the algebra C is A + B
C <- mxAlgebra(A + B, name = "C")

## Not run:  
# the algebra D is sin(C)
D <- mxAlgebra(sin(C), name = "D")

# Evaluate the mxAlgebra object 'D'
modelD <- mxModel(model="AlgebraExample", A, B, C, D, mxAlgebraObjective("D"))
modelD <- mxRun(modelD)
## End(Not run)


[Package OpenMx version 0.1-1 Index]