Hi Mike,

I am running the metaSEM for a mediation model. The results seem good. But when I tried to extrcat the cofficients, there is a problem. In this model, there are three indepent variables and there should be three correlation coefficients between those three variables as well. But in the summary and coef results, there is only one correlation coefficients, cor = 0.43. I want to report all coefficients in my meta-analysis. So could you please check my code and tell me how to read those three correlation coefficients?

Here is my code.

library(metaSEM)

library(lavaan)

x1 <- matrix(c(

1,0.49,0.5,0.23,0.21,

0.49,1,0.46,0.13,0.17,

0.5,0.46,1,0.29,0.49,

0.23,0.13,0.29,1,0.58,

0.21,0.17,0.49,0.58,1),

nrow = 5, ncol = 5, byrow = TRUE, dimnames = list(c("SOP","OOP","SPP","RUM","DEP"),c("SOP","OOP","SPP","RUM","DEP")))

x2 <- matrix(c(

1,0.49,0.5,0.23,0.24,

0.49,1,0.46,0.13,0.12,

0.5,0.46,1,0.29,0.47,

0.23,0.13,0.29,1,0.55,

0.24,0.12,0.47,0.55,1),

nrow = 5, ncol = 5, byrow = TRUE, dimnames = list(c("SOP","OOP","SPP","RUM","DEP"),c("SOP","OOP","SPP","RUM","DEP")))

x3 <- matrix(c(

1,0.42,0.49,0.23,-0.17,

0.42,1,0.41,0.22,0.05,

0.49,0.41,1,0.27,0.3,

0.23,0.22,0.27,1,0.4,

-0.17,0.05,0.3,0.4,1),

nrow = 5, ncol = 5, byrow = TRUE, dimnames = list(c("SOP","OOP","SPP","RUM","DEP"),c("SOP","OOP","SPP","RUM","DEP")))

x4 <- matrix(c(

1,0.5,0.54,0.21,0.15,

0.5,1,0.36,0.11,0.1,

0.54,0.36,1,0.41,0.39,

0.21,0.11,0.41,1,0.54,

0.15,0.1,0.39,0.54,1),

nrow = 5, ncol = 5, byrow = TRUE, dimnames = list(c("SOP","OOP","SPP","RUM","DEP"),c("SOP","OOP","SPP","RUM","DEP")))

x5 <- matrix(c(

1,0.44,0.47,0.26,0.07,

0.44,1,0.44,0.22,0.06,

0.47,0.44,1,0.38,0.4,

0.26,0.22,0.38,1,0.53,

0.07,0.06,0.4,0.53,1),

nrow = 5, ncol = 5, byrow = TRUE, dimnames = list(c("SOP","OOP","SPP","RUM","DEP"),c("SOP","OOP","SPP","RUM","DEP")))

x6 <- matrix(c(

1,0.31,0.41,0.26,0.17,

0.31,1,0.23,0.03,-0.11,

0.41,0.23,1,0.49,0.47,

0.26,0.03,0.49,1,0.66,

0.17,-0.11,0.47,0.66,1),

nrow = 5, ncol = 5, byrow = TRUE, dimnames = list(c("SOP","OOP","SPP","RUM","DEP"),c("SOP","OOP","SPP","RUM","DEP")))

x7 <- matrix(c(

1,0.46,0.38,0.18,0.03,

0.46,1,0.3,0.06,0.06,

0.38,0.3,1,0.29,0.3,

0.18,0.06,0.29,1,0.56,

0.03,0.06,0.3,0.56,1),

nrow = 5, ncol = 5, byrow = TRUE, dimnames = list(c("SOP","OOP","SPP","RUM","DEP"),c("SOP","OOP","SPP","RUM","DEP")))

x8 <- matrix(c(

1,0.46,0.38,0.17,0.03,

0.46,1,0.3,0.1,0.06,

0.38,0.3,1,0.26,0.3,

0.17,0.1,0.26,1,0.42,

0.03,0.06,0.3,0.42,1),

nrow = 5, ncol = 5, byrow = TRUE, dimnames = list(c("SOP","OOP","SPP","RUM","DEP"),c("SOP","OOP","SPP","RUM","DEP")))

x9 <- matrix(c(

1,0.33,0.48,0.34,0.21,

0.33,1,0.08,0.05,-0.06,

0.48,0.08,1,0.58,0.41,

0.34,0.05,0.58,1,0.37,

0.21,-0.06,0.41,0.37,1),

nrow = 5, ncol = 5, byrow = TRUE, dimnames = list(c("SOP","OOP","SPP","RUM","DEP"),c("SOP","OOP","SPP","RUM","DEP")))

x10 <- matrix(c(

1,0.33,0.48,0.07,0.21,

0.33,1,0.08,0.13,-0.06,

0.48,0.08,1,0.35,0.41,

0.07,0.13,0.35,1,0.76,

0.21,-0.06,0.41,0.76,1),

nrow = 5, ncol = 5, byrow = TRUE, dimnames = list(c("SOP","OOP","SPP","RUM","DEP"),c("SOP","OOP","SPP","RUM","DEP")))

x11 <- matrix(c(

1,0.43,0.47,0.22,0.13,

0.43,1,0.38,0.14,0.09,

0.47,0.38,1,0.36,0.34,

0.22,0.14,0.36,1,0.52,

0.13,0.09,0.34,0.52,1),

nrow = 5, ncol = 5, byrow = TRUE, dimnames = list(c("SOP","OOP","SPP","RUM","DEP"),c("SOP","OOP","SPP","RUM","DEP")))

my.df1<-list("1"=x1,"2"=x2,"3"=x3,"4"=x4,"5"=x5,"6"=x6,"7"=x7,"8"=x8,"9"=x9,"10"=x10,"11"=x11)

my.df1

n <-c(150,150,155,279,224,140,305,305,50,50,213)

n

fixed1 <- tssem1(my.df1, n, method="FEM")

summary(fixed1)

model <- "

RUM~SPP2RUM*SPP + SOP2RUM*SOP + OOP2RUM*OOP

DEP~SPP2DEP*SPP + SOP2DEP*SOP + OOP2DEP*OOP + RUM2DEP*RUM

SOP~~1*SOP

OOP~~1*OOP

SPP~~1*SPP

SOP~~cor*OOP

SOP~~cor*SPP

OOP~~cor*SPP

RUM~~var_RUM*RUM

DEP~~var_DEP*DEP"

RAM <- lavaan2RAM(model, obs.variables=c("SOP","OOP","SPP","RUM","DEP"))

RAM

A1 <- RAM$A

S1 <- RAM$S

fixed2 <- tssem2(fixed1, Amatrix=A1, Smatrix=S1, diag.constraints=TRUE, intervals.type="LB", model.name="perfectionism rum dep")

summary(fixed2)

coef(fixed2)

vcov(fixed2)

Many thanks,

Yu Xie

I edited your post to use filtered HTML instead of full HTML formatting, because your syntax wasn't displaying correctly.

ProTip: for lengthy blocks of R code, either post them as a file attachment, or use the appropriate HTML tag ('code' or 'rsplus').

Hi Yu Xie,

These three correlations are constrained equally because you used "cor" to label them.

The following code should work.

Mike