Published on *OpenMx* (http://openmx.psyc.virginia.edu)

By *mspiegel*

Created *09/02/2009 - 14:43*

Wed, 09/02/2009 - 14:43 — mspiegel [1]

How desirable is it that we continue to support matrix and algebra substitution. Matrix substitution will take a 1 x 1 matrix with name 'foo', and then any other matrix with the fixed parameter named 'foo' will get the value stored in the 'foo' matrix. Algebra substitution will take a 1 x 1 matrix with name 'foo', and then any other matrix with the fixed parameter named 'foo' will get the value computed by the 'foo' algebra. This idea is completely orthogonal to constant substitution and free parameter substitution. The target of matrix and algebra substitution is a matrix, while the target of constant substitution and free parameter substitution is an algebra.

The problem is that including matrix and algebra substitution prevents us from making the rule that free parameters, fixed parameters, and named entities all must have non-overlapping names. Personally I find matrix and algebra substitution a bit confusing. Take a look at this example that is in our test suite. Is it intuitive what is happening here?

aMatrix <- mxMatrix(values = matrix(1, 1, 1), name = 'a') bMatrix <- mxMatrix(values = matrix(2, 1, 1), name = 'b') cMatrix <- mxMatrix(values = matrix(3, 1, 1), name = 'c') dMatrix <- mxMatrix(values = matrix(4, 1, 1), name = 'd') eMatrix <- mxMatrix(labels = c('a','b','c','d'), nrow = 2, ncol = 2, byrow = TRUE, name = 'e') model <- mxModel(aMatrix, bMatrix, cMatrix, dMatrix, eMatrix) model <- mxRun(model) expected <- matrix(c(1, 2, 3, 4), nrow = 2, ncol = 2, byrow = TRUE) omxCheckEquals(mxEval(e, model), expected)

Is there a strong use case for matrix and algebra substitution? Because otherwise I am in favor of eliminating this feature.

**Links:**

[1] http://openmx.psyc.virginia.edu/users/mspiegel

[2] http://openmx.psyc.virginia.edu/thread/175

[3] http://openmx.psyc.virginia.edu/thread/151

[4] http://openmx.psyc.virginia.edu/forums/openmx-developer-forums/r-functions-and-user-interface