You are here

examples of parameter constraints possibly with mxAlgebra?

2 posts / 0 new
Last post
JWiley's picture
Offline
Joined: 03/25/2011 - 07:53
examples of parameter constraints possibly with mxAlgebra?

Does anyone have or know of where I could find examples of models where some paths are functions of other parameters? For example, suppose I wanted to estimate two parameters for three paths so the third was a function of the first two: a, b, b + a/2. I've been looking at the ABO blood group example in the documentation, which does some things similar to what I want, but it is a stretch.

Thanks in advance!

Ryne's picture
Offline
Joined: 07/31/2009 - 15:12
You can do this using

You can do this using square-bracket substitution. Briefly, when you assign a label of Object[row,column], that matrix element/path is replaced by the referenced element of that object. So labeling a matrix element or path "c[1,1]" tells OpenMx to (a) find a matrix or algebra called 'c', (b) find the element in the 1st row and 1st column, and (c) put that value into this position.

Here's your path statement, with the path between w and z labeled as "the 1st row and 1st column of the matrix or algebra named 'c'"

mxPath(from="w", to=c("x", "y", "z"), labels=c("a", "b", "c[1,1]"))
 
You could of course do the same thing with a matrix
<code>
mxMatrix("Full", 3, 1, labels=c("a", "b", "c[1,1]"), name="whatever")
 
And here's the algebra. Put them both in your model. I swapped the order of a and b from your above comment to make it clear that order of operations matters.
<code>
mxAlgebra(a/2 + b, name="c")
 
Here's some more info on square bracket substitution:
http://openmx.psyc.virginia.edu/wiki/mxmatrix-help#Square_bracket_substitution_to_set_labels
http://openmx.psyc.virginia.edu/thread/193