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

By *fife*

Created *06/29/2012 - 21:30*

Fri, 06/29/2012 - 21:30 — fife [1]

I've been trying to replicate a model by Preacher (2006). I've enclosed the graphic of the model. And here's my code:

multiRegModelPr2 <- mxModel("Preacher 2",

type="RAM",

mxData(

observed=data,

type="raw"

),

manifestVars=c("x", "y", "z"),

latentVars = c("z1", "z2", "z3"),

# variance paths

mxPath(

from=c("x", "y", "z", "z1", "z2", "z3"),

arrows=2,

free=c(T,T,T,F,F,F),

values = c(.5, .5, .5, 1, 1, 1),

labels=c("d1", "d2", "d3", NA, NA, NA)

),

# covariance of x and z

mxPath(

from="z2",

to="z3",

arrows=2,

free=TRUE,

values=0.2,

labels="covxz"

),

# regression weights from Z1

mxPath(

from=c("z1"),

to=c("z","y", "x"),

arrows=1,

free=TRUE,

values=.5,

labels=c("bz", "by", "bx")

),

# regression weights from Z2

mxPath(

from=c("z2"),

to=c("x"),

arrows=1,

free=TRUE,

values=.5,

labels=c("bx2")

),

# regression weights from Z3

mxPath(

from=c("z3"),

to=c("y"),

arrows=1,

free=TRUE,

values=.5,

labels=c("by2")

),

# means and intercepts

mxPath(

from="one",

to=c("x", "y", "z", "z1", "z2", "z3"),

arrows=1,

free=c(T,T,T,F,F,F),

values=c(.5, .5, .5, 0, 0,0),

labels=c("meanx", "beta0", "meanz", NA, NA,NA)

)

) # close model #

I'm getting really weird estimates that disagree with SAS estimates. Any help would be appreciated! Thanks!

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

Screen shot 2012-06-29 at 8.29.11 PM.png [2] | 75.28 KB |

**Links:**

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

[2] http://openmx.psyc.virginia.edu/sites/default/files/Screen shot 2012-06-29 at 8.29.11 PM.png

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

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

[5] http://openmx.psyc.virginia.edu/forums/opensem-forums/general-sem-discussions