YunyiShen / CAR-LASSO

Conditional Auto-Regressive LASSO in R
https://yunyishen.github.io/CAR-LASSO
GNU General Public License v3.0
17 stars 5 forks source link

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

Open Sophiayangg opened 7 months ago

Sophiayangg commented 7 months ago

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.

  2. 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)
crsl4 commented 7 months ago

Can you add the commands to read the data as well so that there is a reproducible set of commands? Thanks Sophia!