daijiang / phyr

Functions for phylogenetic analyses
https://daijiang.github.io/phyr/
GNU General Public License v3.0
30 stars 10 forks source link

covariance matrix invertion by cholesky #63

Open lucas-jardim opened 3 years ago

lucas-jardim commented 3 years ago

Dear,

I am trying to use pglmm, but it returns this error "Error in chol.default(re.i[[3]]) : the leading minor of order 13 is not positive definite", because the chol function, in get_design_matrix, cannot invert my spatial covariance matrix. However, I can invert the spatial covariance matrix using the function base::solve. There is a possibility to allow the user to choose the inversion function such as base::solve or MASS::ginv. Do you have any suggestion to turn my matrix invertible, I tried to add a small noise to the matrix values but it was not effective.

Best wishes,

daijiang commented 3 years ago

Can you please share an examplary dataset and the code so that we can reproduce your problem? Thanks.