These reseources are intended primarily for the use of my students, but others may find them useful as well.
There are several R packages that make doing bayesian data analysis in R easier. For an overview see the CRAN Bayesian task view. A few are highlighted below.
The CalvinBayes package includes data sets (including all the data sets from Kruschke text below) and a collection of utilties to make our Bayesian lives easier. Some of these are modeled after or similar to functions that Kruschke provides in his many R files. Others help smooth over differences that arise when fitting Bayesian models in different ways.
The ggformula package introduces a family of graphics functions, gf_point()
, gf_density()
, and so on, bringing the formula interface to ggplot()
. This captures and extends the excellent simplicity of the lattice-graphics formula interface, while providing the intuitive “add this component” capabilities of ggplot2 using maggrittr pipes.
Tutorials:
According to its development team, JAGS (Just Another Gibbs Sampler) is a program for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation not wholly unlike BUGS. JAGS was written with three aims in mind:
There are several packages that facilitate using JAGS in R. For an overview of these packages see Using JAGS via R by Karreth (see also his github page). Here is how the packages are described in this tutorial:
One advantage of R2jags is that JAGS models can be described in R without manually writing them to a file first.
According to its development team, Stan® is a state-of-the-art platform for statistical modeling and high-performance statistical computation. Users specify log density functions in Stan’s probabilistic programming language and get:
Stan’s math library provides differentiable probability functions & linear algebra (C++ autodiff). Additional R packages provide expression-based linear modeling, posterior visualization, and leave-one-out cross-validation.
rstan is the R interface to Stan. Several other packages are built on top of it.
bayesplot is an R package providing an extensive library of plotting functions for use after fitting Bayesian models (typically with MCMC). Currently bayesplot offers a variety of plots of posterior draws, visual MCMC diagnostics, as well as graphical posterior predictive checking. Additional functionality (e.g. for forecasting/out-of-sample prediction and other inference-related tasks) will be added in future releases.
The plots created by bayesplot are ggplot objects, which means that after a plot is created it can be further customized using the various functions for modifying ggplot objects provided by the ggplot2 or ggformula packages.
shinystan provides immediate, informative, customizable visual and numerical summaries of model parameters and convergence diagnostics for MCMC simulations. The ShinyStan interface is coded primarily in R using the Shiny web application framework and is available via the shinystan R package.
ShinyStan can be used to explore the output of any MCMC program (including but not limited to Stan, JAGS, BUGS, MCMCPack, NIMBLE, emcee, and SAS).
brms is a package built on top of Stan for fitting a wide range of multilevel models using syntax borrowed from lme4.
ggs()
converts various types of objects produced by Bayesian MCMC algorithms into a tidy data frame suitable for plotting.ggs_*()
: a number of functions take the output from ggmcmc()
and produce a ggplot2
plot. Examples: ggs_density()
, ggs_histogram()
, ggs_traceplot()
, ….The rethinking package is a companion to Statistical Rethinking by McElreath (see below). It provides a nice interface between Stan and R and many other utilities as well. The package is not on CRAN (only on github), and development seems to have stalled, but you may find it interesting, especially if you use his book.
When I taught in 2017, I created a fork of the package to add a few improvements. My fork is not under active development, but you can still find it at https://github.com/rpruim/rethinking.
An online book to accompany the Kruschke text. It will include
Just Another Gibbs Sampler
How to Communicate Statistical Findings by Jane E. Miller
Objections to Bayesian statistics by Andrew Gelman
Abstract: Bayesian inference is one of the more controversial approaches to statistics. The fundamental objections to Bayesian methods are twofold: on one hand, Bayesian methods are presented as an automatic inference engine, and this raises suspicion in anyone with applied experience. The second objection to Bayes comes from the opposite direction and addresses the subjective strand of Bayesian inference. This article presents a series of objections to Bayesian inference, written in the voice of a hypothetical anti-Bayesian statistician. The article is intended to elicit elaborations and extensions of these and other arguments from non-Bayesians and responses from Bayesians who might have different perspectives on these issues.
Faster estimation of Bayesian models in ecology using Hamiltonian Monte Carlo paper by Cole C. Monnahan, James T. Thorson, and Trevor A. Branch
Bayesian Estimation Supersedes the t-test by Kruschke
Randomness and God’s Governance