Specifying a Mediation Model in OpenMx using metaSEM

2 replies [Last post]
xander's picture
Offline
Joined: 11/09/2013

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).
When I run it with tssem2(), my model fit indices are all 0, 1, or Inf.

Thank you so much for your help!

-Xander

xander's picture
Offline
Joined: 11/09/2013
Fixed!: Over-specifed Model

Sorry everyone,

I looked back and it seems like my model was overspecified. I simply put in an identity matrix for S1 and it works now.

Thank you anyways!

-Xander

Mike Cheung's picture
Offline
Joined: 10/08/2009
Hi Xander, I assume that you

Hi Xander,

I assume that you are analyzing correlation matrices. It is correct to fix the variance of W (an independent variable) at 1. However, it is incorrect to fix the error variances of X, Z and Y (dependent variables) at 1. You may need to free these error variances. Moreover, the covariance between the errors of X and Z may also be freed.

BTW, there is a forum for the metaSEM package at http://openmx.psyc.virginia.edu/forums/third-party-software/metasem Feel free to post questions related to metaSEM there.

Mike