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

By *mspiegel*

Created *03/28/2011 - 19:20*

Mon, 03/28/2011 - 19:20 — mspiegel [1]

But this code generates the model:

What happened here? The explanation: When the mxPath() function is called with all = TRUE, it will generate n x m paths, where n is the length of 'from' argument and 'm' is the length of the 'to' argument. Keep in mind that when a path is created, it will clobber any existing path that has the same 'from', 'to', and number of arrows. In the case of symmetric paths, the 'from' and 'to' arguments can be switched with impunity. So the following paths are created:

Imagine I want to create the following model:

I try creating this model fragment using the following R code:

lVars <- c('a', 'b') freeParams <- c('p1', 'p2', 'p3') model <- mxModel('model', type = 'RAM', latentVars = lVars, mxPath(from = lVars, to = lVars, arrows = 2, all = TRUE, labels = freeParams))

But this code generates the model:

What happened here? The explanation: When the mxPath() function is called with all = TRUE, it will generate n x m paths, where n is the length of 'from' argument and 'm' is the length of the 'to' argument. Keep in mind that when a path is created, it will clobber any existing path that has the same 'from', 'to', and number of arrows. In the case of symmetric paths, the 'from' and 'to' arguments can be switched with impunity. So the following paths are created:

From | To | Label |
---|---|---|

a | a | p1 |

a | b | p2 |

b | a | p3 |

b | b | p1 |

This is a bug, right? The expected behavior when all = TRUE and arrows = 2 is not to clobber 1/2 of the generated paths. Does anyone have an example where the behavior shown here is the desired behavior?

Attachment | Size |
---|---|

correct.jpg [2] | 69.54 KB |

incorrect.jpg [3] | 69.4 KB |

**Links:**

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

[2] http://openmx.psyc.virginia.edu/sites/default/files/correct.jpg

[3] http://openmx.psyc.virginia.edu/sites/default/files/incorrect.jpg

[4] http://openmx.psyc.virginia.edu/thread/1042

[5] http://openmx.psyc.virginia.edu/thread/821

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