All Projects → merliseclyde → BAS

merliseclyde / BAS

Licence: GPL-3.0 license
BAS R package https://merliseclyde.github.io/BAS/

Programming Languages

c
50402 projects - #5 most used programming language
r
7636 projects

Projects that are alternatives of or similar to BAS

Mlr
Machine Learning in R
Stars: ✭ 1,542 (+4183.33%)
Mutual labels:  cran, regression, r-package, predictive-modeling
Bayesplot
bayesplot R package for plotting Bayesian models
Stars: ✭ 276 (+666.67%)
Mutual labels:  bayesian, r-package, mcmc
Posterior
The posterior R package
Stars: ✭ 75 (+108.33%)
Mutual labels:  bayesian, r-package, mcmc
cmdstanr
CmdStanR: the R interface to CmdStan
Stars: ✭ 82 (+127.78%)
Mutual labels:  bayesian, r-package, mcmc
Shinystan
shinystan R package and ShinyStan GUI
Stars: ✭ 172 (+377.78%)
Mutual labels:  bayesian, r-package, mcmc
sl3
💪 🤔 Modern Super Learning with Machine Learning Pipelines
Stars: ✭ 93 (+158.33%)
Mutual labels:  regression, model-selection, r-package
Gpstuff
GPstuff - Gaussian process models for Bayesian analysis
Stars: ✭ 106 (+194.44%)
Mutual labels:  regression, bayesian, mcmc
oem
Penalized least squares estimation using the Orthogonalizing EM (OEM) algorithm
Stars: ✭ 22 (-38.89%)
Mutual labels:  cran, variable-selection, r-package
globals
🌐 R package: Identify Global Objects in R Expressions
Stars: ✭ 27 (-25%)
Mutual labels:  cran, r-package
covidestim
Bayesian nowcasting with adjustment for delayed and incomplete reporting to estimate COVID-19 infections in the United States
Stars: ✭ 20 (-44.44%)
Mutual labels:  r-package, mcmc
rcppfastfloat
Rcpp Bindings for the 'fastfloat' Header-Only Library
Stars: ✭ 18 (-50%)
Mutual labels:  cran, r-package
thinkr
Some tools for cleaning up messy 'Excel' files to be suitable for R
Stars: ✭ 21 (-41.67%)
Mutual labels:  cran, r-package
geostan
Bayesian spatial analysis
Stars: ✭ 40 (+11.11%)
Mutual labels:  bayesian, r-package
ctrdata
Aggregate and analyse information on clinical trials from public registers
Stars: ✭ 26 (-27.78%)
Mutual labels:  cran, r-package
rcpptoml
Rcpp Bindings to C++ parser for TOML files
Stars: ✭ 26 (-27.78%)
Mutual labels:  cran, r-package
bruceR
📦 BRoadly Useful Convenient and Efficient R functions that BRing Users Concise and Elegant R data analyses.
Stars: ✭ 110 (+205.56%)
Mutual labels:  cran, r-package
go-topics
Latent Dirichlet Allocation
Stars: ✭ 23 (-36.11%)
Mutual labels:  bayesian, mcmc
vosonSML
R package for collecting social media data and creating networks for analysis.
Stars: ✭ 65 (+80.56%)
Mutual labels:  cran, r-package
apsimx
R package for APSIM-X
Stars: ✭ 30 (-16.67%)
Mutual labels:  cran, r-package
walker
Bayesian Generalized Linear Models with Time-Varying Coefficients
Stars: ✭ 38 (+5.56%)
Mutual labels:  bayesian, mcmc

BAS: Bayesian Variable Selection and Model Averaging using Bayesian Adaptive Sampling

CII Best Practices R-CMD-check Coverage Status Rdoc DOI

The BAS R package is designed to provide an easy to use package and fast code for implementing Bayesian Model Averaging and Model Selection in R using state of the art prior distributions for linear and generalized linear models. The prior distributions in BAS are based on Zellner’s g-prior or mixtures of g-priors for linear and generalized linear models. These have been shown to be consistent asymptotically for model selection and inference and have a number of computational advantages. BAS implements three main algorithms for sampling from the space of potential models: a deterministic algorithm for efficient enumeration, adaptive sampling without replacement algorithm for modest problems, and a MCMC algorithm that utilizes swapping to escape from local modes with standard Metropolis-Hastings proposals.

Installation

The stable version can be installed easily in the R console like any other package:

install.packages('BAS')

On the other hand, I welcome everyone to use the most recent version of the package with quick-fixes, new features and probably new bugs. It’s currently hosted on GitHub. To get the latest development version from GitHub, use the devtools package from CRAN and enter in R:

devtools::install_github('merliseclyde/BAS')

You can check out the current build and test coverage status courtesy Travis CI: before installing.

Installing the package from source does require compilation of C and FORTRAN code as the library makes use of BLAS and LAPACK for efficient model fitting. See CRAN manuals for installing packages from source under different operating systems.

Usage

To begin load the package:

library(BAS)

The two main function in BAS are bas.lm and bas.glm for implementing Bayesian Model Averaging and Variable Selection using Zellner’s g-prior and mixtures of g priors. Both functions have a syntax similar to the lm and glm functions respectively. We illustrate using BAS on a simple example with the famous Hald data set using the Zellner-Siow Cauchy prior via

data(Hald)
hald.ZS = bas.lm(Y ~ ., data=Hald, prior="ZS-null", modelprior=uniform(), method="BAS")

BAS has summary, plot coef, predict and fitted functions like the lm/glm functions. Images of the model space highlighting which variable are important may be obtained via

image(hald.ZS)

Run demo("BAS.hald") or demo("BAS.USCrime") or see the package vignette for more examples and options such as using MCMC for model spaces that cannot be enumerated.

Generalized Linear Models

BAS now includes for support for binomial and binary regression and Poisson regression using Laplace approximations to obtain Bayes Factors used in calculating posterior probabilities of models or sampling of models. Here is an example using the Pima diabetes data set with the hyper-g/n prior:

library(MASS)
data(Pima.tr)
Pima.hgn = bas.glm(type ~ ., data=Pima.tr, method="BAS", family=binomial(),
                  betaprior=hyper.g.n(), modelprior=uniform())

Note, the syntax for specifying priors on the coefficients in bas.glm uses a function with arguments to specify the hyper-parameters, rather than a text string to specify the prior name and a separate argument for the hyper-parameters. bas.lm will be moving to this format sometime in the future.

Feature Requests and Issues

Feel free to report any issues or request features to be added via the github issues page.

For current documentation and vignettes see the BAS website

Support

This material is based upon work supported by the National Science Foundation under Grant DMS-1106891. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].