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

By *xander*

Created *11/09/2013 - 21:53*

Sat, 11/09/2013 - 21:53 — xander [1]

Hello All,

First of all thank you for your hard work over the years to provide us with unique ways to combine meta-analytic principles with SEM--and providing a conduit to do this in R. My research team and I really appreciate it.

I am doing a two stage MASEM with the metaSEM package, and am having some difficulty specifying a mediation analysis in the A/Smatrix. I have four variables: w,x,y,z. And my linear equations are as follows:

X ~ W + e

Z ~ W + e

Y ~ W + X + Z + e

I would like to see if X or Z (or X and Z) mediate the relationship between W and Y.

I specified the Amatrix and Smatrix as follows:

A1 <- mxMatrix("Full", nrow=4, ncol=4, byrow =TRUE, values=c(rep(0,4),1,rep(0,3),1,rep(0,3),1,1,1, 0),

free=c(rep(FALSE,4),TRUE,rep(FALSE,3),TRUE,rep(FALSE,3),TRUE,TRUE,TRUE, rep(FALSE,1)),

labels=c(rep(NA,4),"ethint",rep(NA,3),"ethind",rep(NA,3),"ethnicity","inter","indep", rep(NA,1)),

name="A1")

S1 <- mxMatrix(type="Symm",nrow=4,ncol=4,byrow=TRUE,values=c(1, 0, 0, 0, 0, 1, .5, 0, 0,.5, 1, 0, 0, 0, 0, 1),

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

labels=c("vareth",NA,NA, NA,NA,"varint","covintind", NA, NA, "covintind","varind", NA, NA, NA, NA, "residual"),

name="S")

Is this the correct way to specify this mediation? I modeled it after the multivariate regression shown on (http://openmx.psyc.virginia.edu/docs/OpenMx/latest/Regression_Matrix.html [2]).

When I run it with tssem2(), my model fit indices are all 0, 1, or Inf.

Thank you so much for your help!

-Xander

**Links:**

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

[2] http://openmx.psyc.virginia.edu/docs/OpenMx/latest/Regression_Matrix.html

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

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

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