Applied researchers interested in Bayesian statistics are increasingly
attracted to R because of the ease of which one can code algorithms to sample
from posterior distributions as well as the significant number of packages
contributed to the Comprehensive R Archive Network (CRAN) that provide tools for Bayesian inference.
This task view catalogs these tools. In this task view, we divide those packages
into four groups based on the scope and focus of the packages. We first review R packages
that provide Bayesian estimation tools for a wide range of models. We then discuss
packages that address specific Bayesian models or specialized methods in Bayesian statistics.
This is followed by a description of packages used for post-estimation analysis.
Finally, we review packages that link R to other Bayesian sampling engines such as
JAGS,
OpenBUGS,
and
WinBUGS.
Bayesian packages for general model fitting
-
The
arm
package contains R functions for Bayesian inference using lm, glm,
mer and polr objects.
-
BACCO
is an R bundle for Bayesian analysis of random functions.
BACCO
contains three sub-packages: emulator, calibrator, and approximator,
that perform Bayesian emulation and calibration of computer programs.
-
bayesm
provides R functions for Bayesian inference for various models
widely used in marketing and micro-econometrics. The models include linear regression models,
multinomial logit, multinomial probit, multivariate probit, multivariate mixture of
normals (including clustering), density estimation using finite mixtures of normals
as well as Dirichlet Process priors, hierarchical linear models, hierarchical multinomial logit,
hierarchical negative binomial regression models, and linear instrumental variable models.
-
bayesSurv
contains R functions to perform Bayesian inference for survival
regression models with flexible error and random effects distributions.
-
DPpackage
contains R functions for Bayesian nonparametric and semiparametric models.
DPpackage currently includes semiparametric models for density estimation, ROC curve analysis,
interval censored data, binary regression models, generalized linear mixed models, and IRT type models.
-
MCMCpack
provides model-specific Markov chain Monte Carlo (MCMC) algorithms for
wide range of models commonly used in the social and behavioral sciences. It contains R functions
to fit a number of regression models (linear regression, logit, ordinal probit, probit, Poisson regression, etc.),
measurement models (item response theory and factor models), changepoint models (binary and Poisson), and models for ecological inference.
It also contains a generic Metropolis sampler that can be used to fit arbitrary models.
-
The
mcmc
package consists of an R function for a random-walk Metropolis algorithm for
a continuous random vector.
Bayesian packages for specific models or methods
-
AdMit
provides functions to perform the fitting of an adapative mixture of Student-t distributions
to a tgarget density through its kernel function. The mixture approximation can be used as the importance density
in importance sampling or as the candidate density in the Metropolis-Hastings algorithm.
-
The
bark
package impelements BARK (Bayesian Additive Regression Kernels)
with feature selection.
-
The
BAS
package implements BMA for regression models using g-priors and mixtures of g-priors.
BAS
utilizes an efficient aglorithm to sample models without replacement.
-
BayHaz
contains a suite of R functions for Bayesian estimation of smooth hazard rates via
Compound Poisson Process (CPP) priors.
-
The
bayesGARCH
package provides a function which perform the Bayesian estimation of the
GARCH(1,1) model with Student's t innovations.
-
BAYSTAR
provides functions for Bayesian estimation of threshold autoregressive models.
-
BayesTree
implements BART (Bayesian Additive Regression Trees)
by Chipman, George, and McCulloch (2006).
-
BCE
contains function to estimates taxonomic compositions from
biomarker data using a Bayesian approach.
-
bcp
implements a Bayesian analysis of changepoint problem using
Barry and Hartigan product partition model.
-
The
BMA
package has functions for Bayesian model averaging for linear models,
generalized linear models, and survival models. The complementary package
ensembleBMA
uses
the
BMA
package to create probabilistic forecasts of ensembles using a mixture of
normal distributions.
-
BMS
implements Bayesian Model Averaging for univariate linear models under Zellner’s g prior.
Options include fixed and flexible g priors, 5 kinds of model prior concepts, and model sampling via model enumeration or MCMC samplers.
Post-processing allows for inference according to different concepts and for plotting
-
BPHO
is a package for Bayesian prediction of higher-order interactions using slice sampling method.
-
bqtl
can be used to fit quantitative trait loci (QTL) models.
This package allows Bayesian estimation of multi-gene models
via Laplace approximations and provides tools for interval mapping of genetic loci.
The package also contains graphical tools for QTL analysis.
-
bspec
performs Bayesian inference on the (discrete) power spectrum of time series.
-
cslogistic
has a function that performs a Bayesian analaysis of
a conditionally specified logistic regression model.
-
dclone
provides low level functions for implementing maximum likelihood estimating procedures
for complex models using data cloning and MCMC methods.
-
deal
provides R functions for Bayesian network analysis;
the current version of covers discrete and continuous variables
under Gaussian network structure.
-
dlm
is a package for Bayesian (and likelihood) analysis of
dynamic linear models. It includes the calculations of
the Kalman filter and smoother, and the forward filtering backward sampling algorithm.
-
EbayesThresh
implements Bayesian estimation for thresholding methods.
Although the original model is developed in
the context of wavelets, this package is useful when researchers need to take
advantage of possible sparsity in a parameter set.
-
eco
fits Bayesian ecological inference models in two by two tables using MCMC methods.
-
evdbayes
provides tools for Bayesian analysis of extreme value models.
-
exactLoglinTest
provides functions for log-linear models that compute
Monte Carlo estimates of conditional P-values for goodness of fit tests.
-
The
HI
package has functions to implement a geometric approach
to transdimensional MCMC methods and random direction multivariate
Adaptive Rejection Metropolis Sampling.
-
The
gbayes()
function in
Hmisc
derives the posterior
(and optionally) the predictive distribution when both the
prior and the likelihood are Gaussian, and when the statistic of interest comes from a two-sample problem.
-
The function
krige.bayes()
in the
geoR
package performs
Bayesian analysis of geostatistical data allowing
specification of different levels of uncertainty in the model parameters.
The
binom.krige.bayes()
function in the
geoRglm
package implements Bayesian posterior simulation and spatial prediction
for the binomial spatial model (see the
Spatial
view for more information).
-
The
lmm
package contains R functions to fit linear mixed models using MCMC methods.
-
MasterBayes
is an R package that implements MCMC methods to
integrate over uncertainity in pedigree configurations estimated from molecular markers and phenotypic data.
-
MCMCglmm
is package for fitting Generalised Linear Mixed Models using MCMC methods.
-
The
mcmcsamp()
function in
lme4
allows MCMC sampling for
the linear mixed model and generalized linear mixed model.
-
The
MNP
package fits multinomial probit models using MCMC methods.
-
monomvn
is an R package for stimation of multivariate normal and Student-t data of arbitrary dimension where the pattern of missing data is monotone.
-
MSBVAR
is an R package for estimating Bayesian Vector
Autoregression models and Bayesian structural Vector Autoregression models.
-
The
pscl
package provides R functions to fit
item-response theory models using MCMC methods
and to compute highest density regions for the Beta distribution and the inverse gamma distribution.
-
The
Ratings
package contains functions to implement the methods to improve the presentation and interpretation of online ratings data.
-
The
RJaCGH
package implements Bayesian analysis of
CGH microarrays using hidden Markov chain models.
The selection of the number of states is made via their posterior
probability computed by reversible jump Markov chain Monte Carlo Methods.
-
RxCEcolInf
fits the R x C inference model described in Greiner and Quinn (2009).
-
SampleSizeMeans
contains a set of R functions for calculating sample size requirements using
three different Bayesian criteria in the context of designing an
experiment to estimate a normal mean or the difference between two
normal means.
-
SampleSizeProportions
contains a set of R functions for calculating sample size requirements using
three different Bayesian criteria in the context of designing an
experiment to estimate the difference between two binomial
proportions.
-
SimpleTable
provides a series of methods to conduct Bayesian inference and sensitivity analysis for causal effects from 2 x 2 and 2 x 2 x K tables.
-
sna, an R package for social network analysis, contains functions to generate posterior samples from Butt's
Bayesian network accuracy model using Gibbs sampling.
-
spBayes
provides R functions that fit Gaussian spatial process models
for univariate as well as multivariate point-referenced data using MCMC methods.
-
spikeslab
provides functions for prediction and variable selection using spike and slab regression.
-
The
tgp
package implements Bayesian treed Gaussian process models:
a spaptial modeling and regression package providing fully Bayesian MCMC posterior inference for
models ranging from the simple linear model, to nonstationary treed Gaussian process, and others in between.
-
The
vcov.gam()
function the
mgcv
package can extract a
Bayesian posterior covariance matrix of the parameters from a fitted
gam
object.
-
zic
provides functions for an MCMC analysis of zero-inflated count models including stochastic search variable selection.
Post-estimation tools
-
BayesValidate
implements a software validation method for Bayesian softwares.
-
The
boa
package provides functions for diagnostics,
summarization, and visualization of MCMC sequences. It imports
draws from BUGS format, or from plain matrices.
boa
provides the Gelman and Rubin,
Geweke, Heidelberger and Welch, and Raftery and Lewis diagnostics,
the Brooks and Gelman multivariate shrink factors.
-
The
coda
(Convergence Diagnosis and Output Analysis) package is a suite of functions that
can be used to summarize, plot, and and diagnose convergence from MCMC samples.
coda
also defines an
mcmc
object
and related methods which are used by other packages. It can easily import MCMC output from WinBUGS, OpenBUGS, and JAGS, or from plain
matrices.
coda
contains the Gelman and Rubin, Geweke, Heidelberger and Welch, and Raftery and Lewis diagnostics.
-
ramps
implements Bayesian geostatistical analysis of Gaussian processes using a reparameterized and marginalized posterior sampling algorithm.
-
scapeMCMC
is a Bayesian companion package of scape which deals with age and time structured population models. It provides multipanel
MCMC diagnostic plots with aestically pleasing defaults and graphical parameters that are easy to change.
Packages for learning Bayesian statistics
-
The
BaM
package is an R package associated with Jeff Gill's book,
"Bayesian Methods: A Social and Behavioral Sciences Approach, Second Edition" (CRC Press, 2007).
-
BayesDA
provides R functions and datasets for "Bayesian Data Analysis, Second Edition" (CRC Press, 2003)
by Andrew Gelman, John B. Carlin, Hal S. Stern, and Donald B. Rubin.
-
The
Bolstad
package contains a set of R functions and data sets for the book
Introduction to Bayesian Statistics, by Bolstad, W.M. (2007).
-
The
LearnBayes
package contains a collection of functions helpful
in learning the basic tenets of Bayesian statistical inference. It contains functions for summarizing basic one and two
parameter posterior distributions and predictive distributions and MCMC algorithms for
summarizing posterior distributions defined by the user. It also contains functions for regression
models, hierarchical models, Bayesian tests, and illustrations of Gibbs sampling.
Packages that link R to other sampling engines
-
bayesmix
is an R package to fit Bayesian mixture models
using
JAGS
.
-
BRugs
provides an R interface on Windows machines to
OpenBUGS
.
It works only under Windows and used to be available from CRAN, now it is
located at the
CRANextras
repository.
-
There are two packages that can be used to interface R with
WinBUGS
.
R2WinBUGS
provides a set of functions to call WinBUGS on
a Windows system and a Linux system;
rbugs
supports Linux systems through
OpenBUGS
on Linux (LinBUGS).
-
glmmBUGS
writes BUGS model files, formats data, and creates starting values for generalized linear mixed models.
-
There are three packages that provide R interface with
Just Another Gibbs Sampler (JAGS)
:
rjags,
R2jags, and
runjags.
-
All of these BUGS engines use graphical models for model specification. As such, the
gR
task view may be of interest.
The Bayesian Inference Task View is written by Jong Hee Park (University of Chicago, IL, USA), Andrew D. Martin (Washington University, St. Louis, MO, USA), and
Kevin M. Quinn (UC Berkeley, Berkeley, CA, USA). Please email the
task view maintainer
with suggestions.