Positive definite vs. positive semidefinite required for phylogenetic regression - error message in brms

Hi!

Running R v. 3.6.0, rstan v. 2.19.3, brms v. 2.13.0 on Ubuntu 18.04.2 LTS.

I’m trying to run a relatively simple phylogenetic regression for some COVID work (I’m afraid it involves confidential patient data, so I can’t share it). Normally I’d just code this up in a full Stan model, but seeing as it was simple, I thought I’d give brms a go.

I’m getting an error when I try to run it (in the test case of the minimal model with just the intercept and the phylogenetic random effect):

Error: Within-group covariance matrices must be positive definite.

Now phylogenetic covariance matricies are only guarenteed to be positive semi-definite (and this one is positive semi-definite not positive definite), I was wondering, is the positive definite condition required for some computational reason I’m missing, or is this just a case of the test being applied being overly strict?

Thanks!

brms has to enfore positive definitness to reliably get the choselky factor of the covariance matrix. You may be able to move your matrix from positive semi-definite to positive definite by adding a very small value to the diagonal.

3 Likes

Thanks for getting back so fast. Adding 0.00000002 to the diagonal did it.

1 Like