Bayesian Statistical Modelling with Stan and brms
A Three-Day Workshop
This workshop provides a comprehensive introduction to Bayesian data analysis for empirical researchers. Starting from the fundamental logic of Bayesian inference, we work through a complete analytical treatment of a simple one-parameter model before moving to practical Bayesian modelling via Markov Chain Monte Carlo methods using Stan and the brms package in R. The topics below are modular: a given delivery will cover a selection depending on the available time, audience background, and emphasis.
Foundations
Introduction to Bayesian Inference
An overview of what Bayesian data analysis is and how it sits within statistics as a discipline. We cover the fundamental differences between Bayesian and classical frequentist approaches and discuss when and why Bayesian methods offer practical advantages.
Bayes’ Rule and the Bernoulli Model
Bayes’ rule is derived from first principles and applied to the Bernoulli model, a classic problem of inferring a probability from binary observations. We develop the likelihood function and introduce the beta distribution as the conjugate prior, visualising how prior beliefs are updated by data to produce the posterior.
Inference in the Bernoulli Model
A complete treatment of Bayesian inference in the analytically tractable Bernoulli model, covering all concepts that generalise to complex models later. Topics include posterior point estimation, credible intervals, highest posterior density intervals, and posterior predictive distributions.
Bayesian Regression
Introduction to MCMC and brms
Markov Chain Monte Carlo methods are introduced as a general numerical solution for Bayesian inference when analytical approaches are not available. We introduce Stan via the brms package and fit our first Bayesian linear regression model, comparing the output directly with classical lm.
Bayesian Linear Regression
In-depth coverage of Bayesian linear regression with continuous and categorical predictors. We examine MCMC diagnostics including trace plots, effective sample size, and Rhat, and explore posterior distributions over regression coefficients using the visualisation tools in brms and bayesplot.
Priors and Model Comparison
A close look at prior specification in brms, including how to inspect default priors, set custom priors, and assess prior sensitivity. Model comparison using leave-one-out cross-validation, WAIC, and Bayes factors is covered in full, with discussion of when each approach is appropriate.
Extensions
Beyond Normal Linear Models
The normal linear model makes assumptions that frequently fail in practice. We show how to relax them using robust regression with Student-t distributed residuals and distributional regression, which models the variance as a function of predictors.
Bayesian Generalised Linear Models
Bayesian generalised linear models for non-normal response variables, with particular focus on binary logistic regression using the Bernoulli family in brms. We cover the logit link, coefficient interpretation, and the extension to other GLM families including Poisson and ordinal regression.
Bayesian Mixed Effects Models
Bayesian approaches to multilevel and mixed effects models for grouped or correlated data. We fit varying intercept and varying slope models using brms, compare with lme4, and discuss the practical advantages of Bayesian mixed models, particularly for complex random effects structures where classical methods struggle.