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

bGlasso malfunctions with probit link #9

Open kjmtaylor22 opened 2 years ago

kjmtaylor22 commented 2 years ago

I've tried to run bGlasso with the same binary dataset as CARlasso (sans predictors). It runs fine with CARlasso and it appears to also be running fine with bGlasso when I use the count dataset and log link instead. The matrix is 122 rows by 25 columns

carNull <- bGlasso(data=phdat[,1:25], link="probit", n_iter=2000, n_burn_in = 1000, thin_by=10)

Algorithm start...
progress:
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**|
Error in Intercept_Graphical_LASSO_hir_Cpp(y, 3, n_iter, n_burn_in, thin_by, : mvnrnd(): given covariance matrix is not symmetric positive semi-definite

YunyiShen commented 2 years ago

Thanks for trying it out! Would you mind providing say head of the binary dataset? One possible reason is that the majority of the dataset is 0 or 1's then the method is not very stable. I would suggest if you have count or composition data use the log or logit link.

kjmtaylor22 commented 2 years ago

Ok yeah, that makes sense. It ended up working just fine with the count data. I added the colSums as well so you could see the proportion of rows (actually 126, not 122) filled. I could try it again by removing some of the samples that have low diversity? There would still be a number of uncommon genera though.

head(phgen)

Oocystis Achnanthes Chlorella Stichococcus Chlorococcaceae Scenedesmus Monoraphidium all_others.1 Miscellaneous all_others Cosmarium unidentified Chlorophyta Oedogonium X1 1 0 1 0 1 1 0 1 1 1 1 0 0 1 X2 1 1 1 1 0 1 0 1 1 1 1 1 1 1 X3 1 1 0 1 0 0 0 0 1 1 0 1 1 1 X4 1 0 1 1 1 1 1 1 1 1 1 1 1 1 X5 0 0 1 1 0 0 0 1 1 0 0 0 0 0 X6 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Gymnodinium Chroococcus Amphora Spirogyra Lyngbya Cryptomonas Rhopalodia Zygnema Mougeotia Nitzschia Gomphonema Chroococcaceae Denticula Chlorococcum Pseudanabaena Ulothrix X1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 X2 0 1 0 0 1 1 0 0 0 0 0 1 0 0 0 0 X3 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 X4 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 X5 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 X6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

colSums(phgen)

Oocystis Achnanthes Chlorella Stichococcus Chlorococcaceae Scenedesmus Monoraphidium all_others.1 Miscellaneous all_others Cosmarium 89 88 88 83 79 78 76 64 59 54 53 unidentified Chlorophyta Oedogonium Gymnodinium Chroococcus Amphora Spirogyra Lyngbya Cryptomonas Rhopalodia Zygnema 48 46 44 39 36 31 27 26 20 20 20 Mougeotia Nitzschia Gomphonema Chroococcaceae Denticula Chlorococcum Pseudanabaena Ulothrix 18 17 16 15 15 14 14 14