Unable to read data

Hi Dr. Cheung and colleague,
I am trying to mimic your codes in your metaSEM article (cheung, 2018). I construct a fake dataset and try the tssem1 as following
a<-matrix(c(1,0.2,0.4,1),ncol=2)
b<-matrix(c(1,0.6,0.4,1),ncol=2)
c<-matrix(c(1,0.3,0.7,1),ncol=2)
d<-matrix(c(1,0.9,0.8,1),ncol=2)
e<-matrix(c(1,0.2,0.5,1),ncol=2)
f<-matrix(c(1,0.36,0.34,1),ncol=2)
g<-matrix(c(1,0.3,0.8,1),ncol=2)
h<-matrix(c(1,0.9,0.2,1),ncol=2)
i<-matrix(c(1,0.2,0.4,1),ncol=2)
mats<-list(a,b,c,d,e,f,g,h,i)
n<-c(5,7,20,39,6,29,30,78,29)
fixed1 <- tssem1(mats,n, method = "FEM")
That is a list of 2*2 var-cov matrices with some arbitrary sample sizes. However, I got the error message “Error in if (all.equal(covMatrix, t(covMatrix))) { : argument is not interpretable as logical’’ when running the tssem1.
I am wondering what is the problem. Is it because of the data format of my fake data and your example data (Becker, 2009)?
Thanks for your time and patience!
Unable to read data
Dear Xin Lin,
The error message means that your covariance/correlation matrices are not symmetric. For example,
a<-matrix(c(1,0.2,0.4,1),ncol=2)
a
[,1] [,2]
[1,] 1.0 0.4
[2,] 0.2 1.0
Best,
Mike
Log in or register to post comments
In reply to Unable to read data by Mike Cheung
Dear Dr. Cheung,
Dear Dr. Cheung,
Your answer is very helpful for me.
I really appreciate your kind and timely response!
Best,
Xin
Log in or register to post comments