CAR-LASSO icon indicating copy to clipboard operation
CAR-LASSO copied to clipboard

Errors:decomposition failed and matrix is singular or not positive definite

Open Sophiayangg opened this issue 3 months ago • 1 comments

Two errors that I've found when running the package are that:

  1. Error: chol(): decomposition failed
CARlasso(Ga0485157_metabat1.059+Ga0485167_maxbin.109+ Ga0485162_maxbin.089+Ga0485161_maxbin.110+Ga0485161_maxbin.075+Ga0485157_metabat1.036+Ga0485165_metabat2_ours.012_sub+Ga0485169_maxbin.201_sub+Ga0485172_maxbin.081_sub+Ga0485168_maxbin.153+ Ga0485172_metabat2_ours.083+ Ga0485162_maxbin.023+ Ga0485160_maxbin.092+ Ga0485158_metabat2_jgi.024+ Ga0485162_metabat1.001+**Ga0485163_metabat1.131**~ depth+wtemp+sp_cond+chlor_rfu+phyco_rfu+fdom_rfu+turb_fnu+do_sat+do_raw+ph, data = data_use, link="log",adaptive = TRUE, n_iter = 5000, n_burn_in = 1000, thin_by = 10)

It is only related to the last column of the responses(Ga0485163_metabat1.131). when removing this last one, the error is gone.

  1. Error: inv_sympd(): matrix is singular or not positive definite
CARlasso(Ga0485157_metabat1.059+Ga0485167_maxbin.109+ Ga0485162_maxbin.089+Ga0485161_maxbin.110+Ga0485161_maxbin.075+Ga0485157_metabat1.036+Ga0485165_metabat2_ours.012_sub+Ga0485169_maxbin.201_sub+Ga0485172_maxbin.081_sub+Ga0485168_maxbin.153+ Ga0485172_metabat2_ours.083+ Ga0485162_maxbin.023+ Ga0485160_maxbin.092+ Ga0485158_metabat2_jgi.024+ Ga0485162_metabat1.001+**Ga0485157_metabat2_jgi.016**~ depth+wtemp+sp_cond+chlor_rfu+phyco_rfu+fdom_rfu+turb_fnu+do_sat+do_raw+ph, data = data_use, link="log",adaptive = TRUE, n_iter = 5000, n_burn_in = 1000, thin_by = 10)

Also related to the last column of the responses(Ga0485157_metabat2_jgi.016). when removing this last one, the error is gone.

Down below is a small dataset to reproduce the error: selected_otus.csv

Down below are the reproducible code

library(CARlasso)
data_use <-read.csv("selected_otus.csv")
otu_res <- CARlasso(Ga0485157_metabat1.059+Ga0485167_maxbin.109+ Ga0485162_maxbin.089+Ga0485161_maxbin.110+Ga0485161_maxbin.075+Ga0485157_metabat1.036+Ga0485165_metabat2_ours.012_sub+Ga0485169_maxbin.201_sub+Ga0485172_maxbin.081_sub+Ga0485168_maxbin.153+ Ga0485172_metabat2_ours.083+ Ga0485162_maxbin.023+ Ga0485160_maxbin.092+ Ga0485158_metabat2_jgi.024+ Ga0485162_metabat1.001+Ga0485163_metabat1.131~ depth+wtemp+sp_cond+chlor_rfu+phyco_rfu+fdom_rfu+turb_fnu+do_sat+do_raw+ph, data = data_use, link="log",adaptive = TRUE, n_iter = 5000, n_burn_in = 1000, thin_by = 10)
otu_res <- horseshoe(otu_res)
plot(otu_res)

Sophiayangg avatar Mar 20 '24 17:03 Sophiayangg