help: "Cov" is not positive definite.

Posted on
No user picture. Kwabenaaaddo Joined: 02/01/2021
Hello Mike,

Thank you for your awesome software. I have been working on a TSSEM and once I run my attached codes on the data in the excel file attached, I get the message below after the first stage regression is completed:

"Error in wls(Cov = pooledS, aCov = aCov, n = tssem1.obj$total.n, RAM = RAM, :
"aCov" is not positive definite.
In addition: Warning message:
In .solve(x = object$mx.fit@output$calculatedHessian, parameters = my.name) :
Error in solving the Hessian matrix. Generalized inverse is used. The standard errors may not be trustworthy."

I have thoroughly checked my codes and data for possible errors but still can not resolve it. Could you please have a look and point out what could be the issue, please?

As a second issue, with similar data structure and codings, I am tried to run the TSSEM for a group of 14 variables. Again after the first stage output, the iterations/estimations for the second stage has been running for days with no output. Is this a normal thing or perhaps an issue of the low processing power of my computer?

Best.

Replied on Fri, 02/05/2021 - 09:16
Picture of user. AdminNeale Joined: 03/01/2013

There used to be a rule of thumb for weighted least squares, I think from PRELIS/LISREL documentation, which recommended minimum sample size of about 200 times the number of variables. Having too little data could cause the problem you are reporting. Highly correlated variables may also generate non-positive definite asymptotic covariance matrices.

Possibly, things would go better with ML and robust standard errors, but I am not familiar with the levels of measurement of your variables.

For the job that has been running for days, try a different optimizer. If you have NPSOL enabled, then switching to it is easy by putting this line after loading the OpenMx library:

mxOption(NULL, 'Default optimizer', 'NPSOL)

Replied on Fri, 02/05/2021 - 16:31
No user picture. Kwabenaaaddo Joined: 02/01/2021

Hello Neale,

Thanks for your suggestions. They were indeed helpful. Is they a way of testing/running/assessing a mediation analysis using the TSSEM, please?

Regards.

Replied on Tue, 02/09/2021 - 21:42
Picture of user. Mike Cheung Joined: 10/08/2009

As Michael has said, the main reason is there is not enough data. There are only 3, 2, or even 1 data point in some cells. You may need to drop some variables before you can fit it. Another option is to apply a fixed-effects model if you can assume homogeneity of correlation matrices.


> pattern.na(cordat, show.na = FALSE)
DUA BNKRISK BSIZE LEV AGE LIQ OWNCON INST PERF
DUA 46 21 18 17 7 5 2 1 34
BNKRISK 21 110 45 40 8 21 18 6 91
BSIZE 18 45 133 47 18 17 17 9 112
LEV 17 40 47 121 14 14 14 8 99
AGE 7 8 18 14 38 2 2 3 37
LIQ 5 21 17 14 2 51 10 2 42
OWNCON 2 18 17 14 2 10 43 1 35
INST 1 6 9 8 3 2 1 18 17
PERF 34 91 112 99 37 42 35 17 162

Regarding the mediation model, we may refer to the following pre-print. https://psyarxiv.com/df6jp/

Best,
Mike