mxAlgebraObjective {OpenMx}R Documentation

Function to Create MxAlgebraObjective Object


This function creates a new MxAlgebraObjective object.




algebra A character string indicating the name of an MxAlgebra or MxMatrix object to use for optimization.


Objective functions are functions for which free parameter values are chosen such that the value of the objective function is minimized. While the other objective functions in OpenMx are packaged with a function to be optimized (i.e., maximum likelihood), the mxAlgebraObjective function uses the referenced MxAlgebra or MxMatrix object as the function to be minimized.

If no free parameters are included in any part of the 'algebra' argument, the mxAlgebraObjective works as an algebra evaluator. If the 'algebra' argument is given an MxMatrix object with no free parameters, the original object is returned. If the 'algebra' argument is given an MxAlgebra object whose referenced matrices and algebras have no free parameters, the mxAlgebraObjective function carries out the operations defined in the 'expression' argument of that MxAlgebra object.

If free parameters are included in the objects references in the 'algebra' argument, the mxAlgebraObjective minimizes the algebra defined in the 'algebra' argument. More than one free parameter may be included in the algebra, but the mxAlgebraObjective should be specified such that the objective function evaluates to a 1x1 matrix or scalar value. If the contents of the 'algebra' argument evaluates to a non-scalar matrix, only the first entry of that matrix is minimized.

To evaluate, place MxAlgebraObjective objects, referenced MxAlgebra and MxMatrix objects, and optional MxBounds and MxConstraint objects in an MxModel object. This model may then be evaluated using the mxRun function. The results of the optimization can be found in the 'output' slot of the resulting model, and may be obtained using the mxEval function.


Returns a new MxAlgebraObjective object. MxAlgebraObjective objects should be included with models with referenced MxAlgebra and MxMatrix objects.


The OpenMx User's guide can be found at


#Create a matrix 'A' with no free parameters
A <- mxMatrix('Full', nrow = 1, ncol = 1, values = c(0), name = 'A')

#Create an algebra 'B', which defines the expression A + A
B <- mxAlgebra(A + A, name = 'B')

#Define the objective function for algebra 'B'
objective <- mxAlgebraObjective('B')

#Place the algebra, its associated matrix and its objective function in a model
model <- mxModel(A, B, objective)

#Evalulate the algebra
modelRun <- mxRun(model)

#View the results

[Package OpenMx version 0.2.1-922 Index]