You are here

error message on TSSEM1-not positive definition

7 posts / 0 new
Last post
jing niu's picture
Offline
Joined: 10/10/2018 - 14:21
error message on TSSEM1-not positive definition
AttachmentSize
Binary Data practise 1.R1.93 KB
File practise2.csv10.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).

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

Dear Jing Niu,

You will notice the issues when you run the following R code.

Regards,
Mike

my.vec[!is.pd(my.vec)]
[[1]]
                   par indiriver commdriver instrumentdriver indiout hostout
par               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]]
                   par indiriver commdriver instrumentdriver indiout hostout
par               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]]
                     par indiriver commdriver instrumentdriver indiout hostout
par                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]]
                   par indiriver commdriver instrumentdriver indiout hostout
par               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]]
                 par indiriver commdriver instrumentdriver indiout hostout
par               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
 
[[6]]
                 par indiriver commdriver instrumentdriver indiout hostout
par               NA        NA         NA               NA      NA      NA
indiriver         NA        NA         NA               NA      NA      NA
commdriver        NA        NA       1.00               NA      NA    2.73
instrumentdriver  NA        NA         NA               NA      NA      NA
indiout           NA        NA         NA               NA      NA      NA
hostout           NA        NA       2.73               NA      NA    1.00
 
[[7]]
                  par indiriver commdriver instrumentdriver indiout hostout
par              1.00        NA         NA               NA      NA    2.01
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.01        NA         NA               NA      NA    1.00
 
[[8]]
                   par indiriver commdriver instrumentdriver indiout hostout
par               1.00        NA         NA               NA      NA   87.79
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          87.79        NA         NA               NA      NA    1.00
 
[[9]]
                   par indiriver commdriver instrumentdriver indiout hostout
par               1.00        NA         NA               NA      NA   39.23
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          39.23        NA         NA               NA      NA    1.00
 
[[10]]
                   par indiriver commdriver instrumentdriver indiout hostout
par              1.000        NA         NA               NA      NA   3.784
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          3.784        NA         NA               NA      NA   1.000
 
[[11]]
                  par indiriver commdriver instrumentdriver indiout hostout
par              1.00        NA         NA             8.64      NA      NA
indiriver          NA        NA         NA               NA      NA      NA
commdriver         NA        NA         NA               NA      NA      NA
instrumentdriver 8.64        NA         NA             1.00      NA      NA
indiout            NA        NA         NA               NA      NA      NA
hostout            NA        NA         NA               NA      NA      NA
 
[[12]]
                  par indiriver commdriver instrumentdriver indiout hostout
par              1.00      3.91       4.19             3.95      NA      NA
indiriver        3.91        NA         NA               NA      NA      NA
commdriver       4.19        NA         NA               NA      NA      NA
instrumentdriver 3.95        NA         NA             1.00      NA      NA
indiout            NA        NA         NA               NA      NA      NA
hostout            NA        NA         NA               NA      NA      NA
 
[[13]]
                  par indiriver commdriver instrumentdriver indiout hostout
par              1.00      4.96       7.15             5.52      NA      NA
indiriver        4.96        NA         NA               NA      NA      NA
commdriver       7.15        NA         NA               NA      NA      NA
instrumentdriver 5.52        NA         NA             1.00      NA      NA
indiout            NA        NA         NA               NA      NA      NA
hostout            NA        NA         NA               NA      NA      NA
jing niu's picture
Offline
Joined: 10/10/2018 - 14:21
Dear 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

File attachments: 
Mike Cheung's picture
Offline
Joined: 10/08/2009 - 22:37
Dear 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

jing niu's picture
Offline
Joined: 10/10/2018 - 14:21
Dear Mike,

Dear Mike,

That was a lot of help! Thanks a lot!

Best wishes,

Jing

jing niu's picture
Offline
Joined: 10/10/2018 - 14:21
Dear Mike,

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

File attachments: 
Mike Cheung's picture
Offline
Joined: 10/08/2009 - 22:37
Dear Jing,

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

File attachments: 
Log in or register to post comments