Attachment | Size |
---|---|
practise 1.R | 1.93 KB |
practise2.csv | 10.79 KB |
Dear Mike,
My name is Jing Niu and I am working on a metaSEM research.When I apply the tssem1 function on my dataset, I got the error message saying:
> stage1fixed <- tssem1(Cov=my.vec, n=samplesize, method="FEM")
Error: The observed covariance matrix is not a positive-definite matrix:
1 or more elements of eigen(covMatrix)$values <= 0
In addition: Warning message:
In tssem1FEM(Cov = Cov, n = n, cor.analysis = cor.analysis, model.name = model.name,
My dataset looks like the following:
> my.vec[c(133,135,136,137,139)]
[[1]]
participation indiriver commdriver instrumentdriver indiout hostout
participation 1.00 NA NA NA NA -7.13
indiriver NA NA NA NA NA NA
commdriver NA NA NA NA NA NA
instrumentdriver NA NA NA NA NA NA
indiout NA NA NA NA NA NA
hostout -7.13 NA NA NA NA 1.00
[[2]]
participation indiriver commdriver instrumentdriver indiout hostout
participation 1.00 NA NA NA NA -1.04
indiriver NA NA NA NA NA NA
commdriver NA NA NA NA NA NA
instrumentdriver NA NA NA NA NA NA
indiout NA NA NA NA NA NA
hostout -1.04 NA NA NA NA 1.00
[[3]]
participation indiriver commdriver instrumentdriver indiout hostout
participation 1.000 NA NA NA NA -13.145
indiriver NA NA NA NA NA NA
commdriver NA NA NA NA NA NA
instrumentdriver NA NA NA NA NA NA
indiout NA NA NA NA NA NA
hostout -13.145 NA NA NA NA 1.000
[[4]]
participation indiriver commdriver instrumentdriver indiout hostout
participation 1.00 NA NA NA NA -2.55
indiriver NA NA NA NA NA NA
commdriver NA NA NA NA NA NA
instrumentdriver NA NA NA NA NA NA
indiout NA NA NA NA NA NA
hostout -2.55 NA NA NA NA 1.00
[[5]]
participation indiriver commdriver instrumentdriver indiout hostout
participation NA NA NA NA NA NA
indiriver NA NA NA NA NA NA
commdriver NA NA 1.00 NA NA 2.15
instrumentdriver NA NA NA NA NA NA
indiout NA NA NA NA NA NA
hostout NA NA 2.15 NA NA 1.00
I tried to use the nearPD function to fix the non-positive definition, but got another error term saying:
> nearPD(my.vec[133])
Error in UseMethod("isSymmetric") :
no applicable method for 'isSymmetric' applied to an object of class "list"
Could you please offer some help for my next step? I appreciate a lot for the kind help! ( I attached my data and code following).
Dear Jing Niu,
You will notice the issues when you run the following R code.
Regards,
Mike
Dear Mike,
I appreciate the kind attention a lot! I learned a lot from your papers and feedbacks you gave to me and others.
Followed your guides, I detect the non-positive definite matrix and apply the tssem1 function, fix-effect one and random-effect one.
For the fix-effect model, I got the results indicating heterogeneity of my data. So I tried the random effect model, in the random effect model, I got the result report :
OpenMx status1: 6 ("0" or "1": The optimization is considered fine.
Other values may indicate problems.)
Also, the heterogeneity indices of my intercept are not all high. Intercept13: I2 is 0.
I am wondering what is the "6" indicates? Could you also share guides for my next step? I attach the summary reports.
Thanks a lot for your kind attention and help!!
Jing
Dear Jing,
You may refer to https://openmx.ssri.psu.edu/wiki/errors for the meanings of the error code.
One simple strategy you may try is to use the rerun() function in the metaSEM package.
Regards,
Mike
Dear Mike,
That was a lot of help! Thanks a lot!
Best wishes,
Jing
Dear Mike,
Sorry for bothering you with more questions. I ran tssem2 with the results I got from tssem1. In tssem2, I set the start values of variable variance and residual variance as 0.1, start values of covariance as 1 when building A matrix and S matrix. However, I got error status 6 of my tssem2 model. When I look at the results, none of them is significant. I tried return() function, but it does not help for this situation.
Could you please share me some guides for my next step? Should I change the start values?
I attach my data and codes. I appreciate a lot for the kind attention. Thank you very much!!
Dear Jing,
There are at least two issues here.
First, there is still an error code in the stage 1 results after rerunning the model. It appears that there are not enough data for this model.
Second, your stage 2 model is a bit strange (please see the attached figure). I hope that this is the model you want.
Best,
Mike