Copyright © 2007-2024 The OpenMx Project
Wiki home page [1]Please add material here as you learn...
If you have questions not answers, then add those here: That's how a wiki works.
mxAlgebra(expression, name = NA, dimnames = NA)
mxAlgebra() allows you create algebraic expressions based on one or more MxMatrix objects. Legal functions are described here [2]
Common misunderstandings are to call mxAlgebra expecting it to be run
To evaluate an MxAlgebra, it must be placed in an MxModel (along with all referenced MxMatrix objects) and run.
A <- mxMatrix("Full", nrow = 3, ncol = 3, values=1:9, name = "A") B <- mxAlgebra(A, name = "B") C <- mxAlgebra(A + B, name = "C") D <- mxAlgebra(sin(C), name = "D") model <- mxModel("AlgebraExample", A, B, C, D ) fit <- mxRun(model) mxEval(AlgebraExample.D, fit) # [,1] [,2] [,3] #[1,] 0.9092974 0.9893582 0.9906074 #[2,] -0.7568025 -0.5440211 -0.2879033 #[3,] -0.2794155 -0.5365729 -0.7509872
A common misunderstanding is to call mxAlgebra() expecting it to be evaluated without subsequently being placed in a model and run as above.