warning message when using metaSEM

Posted on
No user picture. Bo Wang Joined: 03/19/2024
Forums
We want to use metaSEM to conduct a mediation model based on four samples using TSSEM. There was a warning message in the summary of the output from the tssem1 function. The following is the R script we used to run the analysis:

### 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!

Replied on Mon, 03/25/2024 - 07:18
Picture of user. Mike Cheung Joined: 10/08/2009

You may rerun the model to get rid of the warning. The SEs are NAs for the two estimated variances because they hit the lower bound. In other words, the estimated variances could be negative but restricted to be the values of the lower bound. Thus, there is no SE on them.
Replied on Wed, 03/27/2024 - 19:49
Picture of user. Mike Cheung Joined: 10/08/2009

Your code is quite messy. Here is the formatted one. Since the effect sizes are homogeneous, you may consider using the fixed-effects model.


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)