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

By *Janosch*

Created *05/25/2010 - 12:05*

Tue, 05/25/2010 - 12:05 — Janosch [1]

Hello everyone,

i am trying to generate a model with several mxAlgebra objects in it. The thing is that they all have the same structure (except for one value), but must be assigned different names. Right now I'm specifying them seperately, so:

mxAlgebra(EVEC%*%(exp(1%x%EVA)-tempa)%*%solve(EVEC), name = "EXPd1"),

mxAlgebra(EVEC%*%(exp(2%x%EVA)-tempa)%*%solve(EVEC), name = "EXPd2"),

mxAlgebra(EVEC%*%(exp(3%x%EVA)-tempa)%*%solve(EVEC), name = "EXPd3"),

mxAlgebra(EVEC%*%(exp(4%x%EVA)-tempa)%*%solve(EVEC), name = "EXPd4"),

mxAlgebra(EVEC%*%(exp(5%x%EVA)-tempa)%*%solve(EVEC), name = "EXPd5"),

Where the only difference between the algebras is the number in the "exp()". I thought that I could create a vector with those numbers in it and loop through that vector, while giving the mxAlgebra a different name on every iteration. The point is that I want my syntax to work no matter how many different "EXPd's" I have, without having to specify them manually (it could eventually be up to a hundred so that would be a lot of work). I thought of something like:

numbers=c(1,2,3,4,5)

for (i in 1:5){

mxAlgebra(EVEC%*%(exp(numbers[i]%x%EVA)-tempa)%*%solve(EVEC), name = paste("EXPd",i,sep=""))

},

However that doesnt work... openmx doesnt seem to recognize the mxAlgebras.

Does anyone have an idea of how I could get this going? I thought of creating an object in R, so outside of openmx, with the mxAlgebra statements in it and reffering to the specific points in that object in my model specifications. But i couldnt get that going as well.

I'll be glad for any kind of suggestions!

Greetings

Jan

**Links:**

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

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

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

[4] http://openmx.psyc.virginia.edu/forums/openmx-help/openmx-general-help