car-lasso

Conditional Auto-Regressive LASSO in R

https://github.com/yunyishen/car-lasso

Science Score: 20.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
    2 of 4 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.6%) to scientific vocabulary

Keywords

bayesian gaussian-field lasso-regression markov-random-field
Last synced: 6 months ago · JSON representation

Repository

Conditional Auto-Regressive LASSO in R

Basic Info
Statistics
  • Stars: 17
  • Watchers: 3
  • Forks: 5
  • Open Issues: 5
  • Releases: 0
Topics
bayesian gaussian-field lasso-regression markov-random-field
Created almost 6 years ago · Last pushed over 3 years ago
Metadata Files
Readme License

README.md

CARlasso

CARlasso: Conditional Auto-Regressive LASSO in R

With this package, users can infer a graph with two types of nodes: 1) for correlated responses (for example, microbial abundances) and 2) for predictors affecting the responses (for example, environmental or experimental conditions).

The advantages of our implementation is that:

  1. The edges in the graph correspond to conditional dependency (instead of marginal) which agree better with the biological intution behind experiments
  2. The graph is sparse
  3. Because the implementation is Bayesian, users can incorporate prior knowledge into the model

Installation

The package is on CRAN, so to install it, please use:

r install.packages("CARlasso") To install development version from github:

r devtools::install_github("YunyiShen/CAR-LASSO")

Dependencies: The CAR-LASSO R package depends on the following R packages: Rcpp, RcppArmadillo, RcppProgress, coda, Matrix, igraph, ggraph, and ggplot2.

Documentation

For more information, please check out the tutorial.

Fitting a CAR-ALASSO network on human gut microbiome data

To run a reduced version of the analysis on human gut microbiome in our paper (with less predictors and responses):

```r library(CARlasso) gutres <- CARlasso(Alistipes+Bacteroides+ Eubacterium+Parabacteroides+allothers~ BMI+Age+Gender+Stratum, data = mgp154,link = "logit", adaptive = TRUE, niter = 5000, nburnin = 1000, thinby = 10)

horseshoe will take a while, as it needs to sample the latent normal too

gutres <- horseshoe(gutres) plot(gut_res) ``` It might take a little while due to the sampling process of the latent normal variable.

We are using the sample human gut microbiome data included in the package (mgp154). If you want to run this model on your own data, check out the structure of mgp154 to put your data in the same format:

r str(mgp154) head(mgp154)

The color of the edge represents the type of correlation (negative=blue, positive=red) and the width of the edge corresponds to the effect size. Response nodes are represented by circles (in this case, microbes) and predictor nodes are represented by triangles (in this case, age, gender, and stratum).

The Result

Though we don't recommend treating compositional data as counts, as a illustration, we can run the counting model (link = "log"):

```r gutres <- CARlasso(Alistipes+Bacteroides+ Eubacterium+Parabacteroides+allothers~ BMI+Age+Gender+Stratum, data = mgp154,link = "log", adaptive = TRUE, rbeta = 0.1, # default sometimes cause singularity in Poisson model due to exponential transformation, slightly change can fix it. niter = 5000, nburnin = 1000, thin_by = 10)

horseshoe will take a while, as it's currently implemented in R rather than C++

gutres <- horseshoe(gutres) plot(gut_res) ```

The Result

Fitting a CAR-ALASSO network on simulated data

We generate data from a 5-node AR1 model where each node has a specific treatment. Then, we use the adaptive version of CAR-LASSO (CAR-ALASSO) to reconstruct such network and plot the result:

```r set.seed(42) dt <- simuAR1(n=100, k=5, rho=0.7) carres <- CARlasso(y1+y2+y3+y4+y5~x1+x2+x3+x4+x5, data = dt, adaptive = TRUE) plot(car_res,tol = 0.05)

with horseshoe inference

carres <- horseshoe(carres) plot(car_res) ```

The Result

Fitting a standard Graphical LASSO network

Our package also includes functions to fit a standard graphical LASSO, see this page in the tutorial for more details.

Fitting your own hierarchical model

If you would like lower level interface of CAR-LASSO, see this page in the tutorial.

Contributions

Users interested in expanding functionalities in CAR-LASSO R package are welcome to do so. See details on how to contribute in CONTRIBUTING.md.

License

CAR-LASSO R package is licensed under the GNU General Public License v3.0 license.

Citation

If you use the CAR-LASSO R package in your work, we kindly ask that you cite the following paper:

Shen, Y., Solís-Lemus, C. (2020). Bayesian Conditional Auto-Regressive LASSO Models to Learn Sparse Networks with Predictors, arXiv:2012.08397

@article{Shen2020, title = "Bayesian Conditional {Auto-Regressive} {LASSO} Models to Learn Sparse Networks with Predictors", author = "Shen, Yunyi and Solis-Lemus, Claudia", month = dec, year = 2020, archivePrefix = "arXiv", primaryClass = "stat.AP", eprint = "2012.08397" }

Feedback, issues and questions

Feedback, issues and questions are encouraged through the GitHub issue tracker.

Owner

  • Name: Yunyi Shen
  • Login: YunyiShen
  • Kind: user
  • Location: Cambridge
  • Company: Massachusetts Institute of Technology

PhD student at MIT/LIDS, working on Bayesian nonparametrics.

GitHub Events

Total
  • Watch event: 3
Last Year
  • Watch event: 3

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 375
  • Total Committers: 4
  • Avg Commits per committer: 93.75
  • Development Distribution Score (DDS): 0.093
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
YunyiShen y****9@w****u 340
Yunyi Shen 3****n 29
ClaudiaSL s****s@w****u 5
Dirk Eddelbuettel e****d@d****g 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 5
  • Total pull requests: 7
  • Average time to close issues: N/A
  • Average time to close pull requests: 1 day
  • Total issue authors: 4
  • Total pull request authors: 2
  • Average comments per issue: 1.6
  • Average comments per pull request: 0.29
  • Merged pull requests: 7
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • YunyiShen (2)
  • connor-morozumi (1)
  • Sophiayangg (1)
  • kjmtaylor22 (1)
Pull Request Authors
  • crsl4 (6)
  • eddelbuettel (1)
Top Labels
Issue Labels
enhancement (2)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 180 last-month
  • Total docker downloads: 74
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 3
  • Total maintainers: 1
cran.r-project.org: CARlasso

Conditional Autoregressive LASSO

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 180 Last month
  • Docker Downloads: 74
Rankings
Forks count: 11.3%
Stargazers count: 15.6%
Dependent packages count: 29.8%
Average: 30.5%
Dependent repos count: 35.5%
Downloads: 60.4%
Maintainers (1)
Last synced: over 1 year ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • MASS * imports
  • Matrix * imports
  • Rcpp * imports
  • coda * imports
  • ggplot2 * imports
  • ggraph * imports
  • igraph * imports
  • methods * imports
  • knitr * suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/r.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/upload-artifact main composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite