You are here

MetaSEM Error Message-Missing value where TRUE/FALSE needed

5 posts / 0 new
Last post
Xin Lin's picture
Offline
Joined: 06/10/2019 - 15:24
MetaSEM Error Message-Missing value where TRUE/FALSE needed

Hi Dr. Cheung,
I am trying to use my dataset to mimic your code “fixed1 <- tssem1(mat,n, method = "FEM")”
I got the error message “Error in if (!all(isPD)) warning(paste("Group ", (1:no.groups)[!isPD], :
missing value where TRUE/FALSE needed”
I have attached the first five correlation matrices and the sample size (n) for each study.

> mat
[[1]]
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1.00 0.15 -0.05 NA 0.17 NA
[2,] 0.15 1.00 0.19 NA 0.31 NA
[3,] -0.05 0.19 1.00 NA 0.05 NA
[4,] NA NA NA 1 NA NA
[5,] 0.17 0.31 0.05 NA 1.00 NA
[6,] NA NA NA NA NA 1

[[2]]
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1.00 0.39 0.40 NA 0.43 NA
[2,] 0.39 1.00 0.45 NA -0.10 NA
[3,] 0.40 0.45 1.00 NA -0.04 NA
[4,] NA NA NA 1 NA NA
[5,] 0.43 -0.10 -0.04 NA 1.00 NA
[6,] NA NA NA NA NA 1

[[3]]
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1.00 NA 0.690 NA 0.43 0.240
[2,] NA 1 NA NA NA NA
[3,] 0.69 NA 1.000 NA 0.44 0.275
[4,] NA NA NA 1 NA NA
[5,] 0.43 NA 0.440 NA 1.00 0.440
[6,] 0.24 NA 0.275 NA 0.44 1.000

[[4]]
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1.00 NA NA NA NA 0.43
[2,] NA 1 NA NA NA NA
[3,] NA NA 1 NA NA NA
[4,] NA NA NA 1 NA NA
[5,] NA NA NA NA 1 NA
[6,] 0.43 NA NA NA NA 1.00

[[5]]
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1.00 NA NA NA NA 0.22
[2,] NA 1 NA NA NA NA
[3,] NA NA 1 NA NA NA
[4,] NA NA NA 1 NA NA
[5,] NA NA NA NA 1 NA
[6,] 0.22 NA NA NA NA 1.00

> n
[1] 19 16 69 50 50

Thanks for your time and patience!

Best,
Xin Lin

Mike Cheung's picture
Offline
Joined: 10/08/2009 - 22:37
Dear Xin Lin,

Dear Xin Lin,

Could you please post the data and R code?

Best,
Mike

Xin Lin's picture
Offline
Joined: 06/10/2019 - 15:24
Hi Dr. Cheung,

Hi Dr. Cheung,

Thanks for your quick reply!
I have attached the R code and dataset I use.

Best,
Xin

Mike Cheung's picture
Offline
Joined: 10/08/2009 - 22:37
The following code may not

The following code may not work well with lots of missing data.

fixed1 <- tssem1(mat,n, method = "FEM")

You may try:

fixed1 <- tssem1(mat, n, method="REM", RE.type="Zero")
Xin Lin's picture
Offline
Joined: 06/10/2019 - 15:24
Dear Dr. Cheung,

Dear Dr. Cheung,

I really appreciate your kind and timely reply!
It worked well when I tried it again with your code.

Best,
Xin