Fri, 06/29/2012 - 21:30

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 | 75.28 KB |

I echo Mike Hunter's comments. The model you have specified is not the one in the diagram. In part this is because you have two-headed arrows from the manifest variables to themselves which are free. These should be omitted or set fixed with values of zero. Like this perhaps:

Hey Dustin,

In addition to Ryne's comments, it looks like there is some disagreement between the model you wrote in OpenMx and the model in the diagram you attached. As Ryne correctly observed, the model in the diagram is fully saturated: three observed variables, and six estimated parameters. (Let's ignore the mean structure because it is saturated, is not specified in the diagram, and I doubt is causing the problem.) However, the model you wrote estimates 3 variances, 1 covariance, and 5 factor loadings. I would try not estimating the 3 variances. They do not seem to be estimated in the model depicted. That will leave you back with a saturated model and hopefully that will work better than the oversaturated model.

Hope this helps!

Sorry about the late reply. That seemed to do the trick. Thanks!

Without telling us more about your data and results, I can't be exactly sure of what's going on, but I have a few questions and suggestions.

This model is fully saturated, meaning that it should be a perfect fit to the observed covariance matrix: your covariance structure has 6 free parameters representing the 3 variances and 3 covariances in the data, and your means model is saturated as well. It's really weird that you're getting odd results on a saturated model.

Can you tell me any more about missing data structure? Differences in missing data handling could affect results and create differences between OpenMx's FIML solution and whatever PROC you're using in SAS. This is especially true if you're just using a regression PROC or are otherwise using listwise deletion or pairwise complete observations to build a data covariance matrix.

Can you tell us anything else about the "weird" estimates? Are they just not what you expected, or are they outside the range of possible values for your data? Did you get any warnings or error messages? Apologies for the delay; east coast storms knocked out the OpenMx server.