easystats / insight

:crystal_ball: Easy access to model information for various model objects
https://easystats.github.io/insight/
GNU General Public License v3.0
395 stars 39 forks source link

checking diagonal elements of a covariance matrix is insufficient to diagnose singularity #878

Open bbolker opened 4 months ago

bbolker commented 4 months ago

insight has a helper function that claims to check singularity of mixed effect models. It does it by checking to see if any of the diagonal elements of the random effects covariance matrix are less than a tolerance value.

This is insufficient for "unstructured" (general positive definite) covariance matrices with dimension > 2 (and maybe >1, I'm not sure).

See https://github.com/easystats/performance/pull/684

### Tasks
strengejacke commented 4 months ago

We have an improved implementation in the performance package: https://github.com/easystats/performance/blob/main/R/check_singularity.R

Maybe we should this code instead?

bwiernik commented 4 months ago

That's a good idea. Where is the insight helper function used?

bbolker commented 4 months ago

in compute_variances, here

strengejacke commented 3 months ago

Do you have an example of a model we can use for tests?

strengejacke commented 3 months ago

I re-opened after merging the PR, because I still want to add some tests.