mdsteiner / EFAtools

GNU General Public License v3.0
10 stars 3 forks source link

Smoother does not behave as expected #61

Closed FlorianScharf closed 3 years ago

FlorianScharf commented 3 years ago

Hello,

I tried to use your package with a very large correlation matrix and I found that many functions do not smooth when they should and return errors of non-invertible correlation matrices instead of smoothing over it as intended according to the code.

The reason for this is that the smallest eigen values of my correlation matrix are tiny but > 0 (like 10^-14). Thus, according to your criterion (all eigen value <= 0), the matrix is invertible but it turns out that it is numerically not invertible.

I suggest to reconsider the criterion. In other packages I have seen that not 0 but machine tolerance is used as the minimal eigen value. Maybe this would be a simple solution?

Best, Florian

mdsteiner commented 3 years ago

Hi Florian,

good catch, thanks! We test against machine precision in other cases, but did not adapt that when checking for whether a correlation matrix should be smoothed. I have now changed that, such that it tests against .Machine$double.eps^.6 which should fix the issue. Please make sure to install the development version when you want to try it again.

Best, Markus