# warning message when using metaSEM

### Insert correlation matrices

M2_Study_2a <- data.matrix(data.frame(

IV = c(1, 0.236, 0.360),

M = c(0.236, 1, 0.247),

DV = c(0.360, 0.247, 1)

))

M2_Study_2b <- data.matrix(data.frame(

IV = c(1, 0.203, 0.207),

M = c(0.203, 1, 0.174),

DV = c(0.207, 0.174, 1)

))

M2_Study_3 <- data.matrix(data.frame(

IV = c(1, 0.153, 0.439),

M = c(0.153, 1, 0.203),

DV = c(0.439, 0.203, 1)

))

M2_Study_4 <- data.matrix(data.frame(

IV = c(1, 0.198, 0.327),

M = c(0.198, 1, 0.238),

DV = c(0.327, 0.238, 1)

))

### Insert sample sizes information

N_Study_2a <- 198

N_Study_2b <- 200

N_Study_3 <- 278

N_Study_4 <- 296

### Complie the data list

N_M2 <- c(N_Study_2a, N_Study_2b, N_Study_3, N_Study_4)

Cor_Matrix_M2 <- list(M2_Study_2a, M2_Study_2b, M2_Study_3, M2_Study_4)

Cor_Matrix_M2 <- lapply(Cor_Matrix_M2, function(x) {

dimnames(x) <- list(c("IV","M","DV"), c("IV","M","DV"))

x})

Data_M2 <- list(Cor_Matrix_M2, N_M2)

names(Data_M2) <- c("data", "n")

names(Data_M2$data) <- c("Study_2a", "Study_2b", "Study_3", "Study_4")

### Proposed model in lavaan syntax

Mediation_Model <- "DV ~ c*IV + b*M

M ~ a*IV

IV ~~ 1*IV"

plot(Mediation_Model)

obs.vars1 <- as.character(c("IV","M","DV"))

### Convert the lavaan syntax to RAM specification used in metaSEM

RAM <- lavaan2RAM(Mediation_Model, obs.variables=obs.vars1)

### Random-effects model

Random_M2 <- tssem1(Data_M2$data, Data_M2$n, method="REM")

summary(Random_M2)

Then the warning message came up: "Warning: OpenMx status1 is neither 0 or 1. You are advised to 'rerun' it again."

The estimation of the first and third heterogeneity components also seems incorrect because there are NAs, for example, for Std.Error.

Any help would be greatly appreciated!

## You may rerun the model to

Log in or register to post comments

In reply to You may rerun the model to by Mike Cheung

## Thank you for your reply! I

Log in or register to post comments

## Your code is quite messy.

M2_Study_2a <- data.matrix(data.frame(

IV = c(1, 0.236, 0.360),

M = c(0.236, 1, 0.247),

DV = c(0.360, 0.247, 1)

))

M2_Study_2b <- data.matrix(data.frame(

IV = c(1, 0.203, 0.207),

M = c(0.203, 1, 0.174),

DV = c(0.207, 0.174, 1)

))

M2_Study_3 <- data.matrix(data.frame(

IV = c(1, 0.153, 0.439),

M = c(0.153, 1, 0.203),

DV = c(0.439, 0.203, 1)

))

M2_Study_4 <- data.matrix(data.frame(

IV = c(1, 0.198, 0.327),

M = c(0.198, 1, 0.238),

DV = c(0.327, 0.238, 1)

))

N_Study_2a <- 198

N_Study_2b <- 200

N_Study_3 <- 278

N_Study_4 <- 296

N_M2 <- c(N_Study_2a, N_Study_2b, N_Study_3, N_Study_4)

Cor_Matrix_M2 <- list(M2_Study_2a, M2_Study_2b, M2_Study_3, M2_Study_4)

Cor_Matrix_M2 <- lapply(Cor_Matrix_M2, function(x) {

dimnames(x) <- list(c("IV","M","DV"), c("IV","M","DV"))

x})

Data_M2 <- list(Cor_Matrix_M2, N_M2)

names(Data_M2) <- c("data", "n")

names(Data_M2$data) <- c("Study_2a", "Study_2b", "Study_3", "Study_4")

## Random-effects model

Random_M2 <- tssem1(Data_M2$data, Data_M2$n, method="REM")

Random_M2 <- rerun(Random_M2)

summary(Random_M2)

`## Fixed-effects model`

Fixed_M2 <- tssem1(Data_M2$data, Data_M2$n, method="FEM")

summary(Fixed_M2)

Log in or register to post comments