Stan Logo

brms

Bayesian regression models using Stan

brms Logo

The brms package provides an interface to fit Bayesian generalized (non-)linear multivariate multilevel models using Stan. The formula syntax is very similar to that of the package lme4 to provide a familiar and simple interface for performing regression analyses.

A wide range of distributions and link functions are supported, allowing users to fit – among others – linear, robust linear, count data, survival, response times, ordinal, zero-inflated, hurdle, and even self-defined mixture models all in a multilevel context. Further modeling options include non-linear and smooth terms, auto-correlation structures, censored data, missing value imputation, and quite a few more. In addition, all parameters of the response distribution can be predicted in order to perform distributional regression. Multivariate models (i.e. models with multiple response variables) can be fitted, as well. Prior specifications are flexible and explicitly encourage users to apply prior distributions that actually reflect their beliefs. Model fit can easily be assessed and compared with posterior predictive checks, leave-one-out cross-validation, and Bayes factors.

Getting Started

If you are new to brms we recommend starting with the vignettes and these other resources:

Installation

Install the latest release from CRAN

Install the latest development version from GitHub

if (!require(devtools)) {
  install.packages("devtools")
}
devtools::install_github("stan-dev/brms", build_vignettes = TRUE)

You can also set build_vignettes=FALSE for a faster installation from GitHub (the vignettes can always be accessed online anytime at mc-stan.org/brms/articles).