This course introduces all the essential ingredients needed to start Bayesian estimation and inference. We discuss specifying priors, obtaining the posterior, prior/posterior predictive checking, sensitivity analyses, and the usefulness of a specific class of priors called shrinkage priors. We propose strategies for reproducibility and reporting standards, outlining the WAMBS-checklist (when to Worry and how to Avoid the Misuse of Bayesian Statistics). We have prepared many exercises to enable students to get hands-on experience.
The popularity of Bayesian statistics has increased over the years; however, Bayesian methods are not a part of the statistics curricula in most graduate programs internationally. The Bayesian framework can handle some commonly encountered problems in classical statistics, such as the lack of power in small sample research and convergence issues in complex models. Furthermore, some researchers prefer the Bayesian framework because it sequentially updates knowledge with new data instead of requiring that each new study tests the null hypothesis that there is no effect in the population. The main focus of the course is on conceptually understanding Bayesian inference and applying Bayesian methods.
The instructors will clarify the differences between the philosophies and interpretations in classical and Bayesian frameworks. They illustrate how types of research questions can be answered using Bayesian methods. This course will also give students experience running Bayesian analyses and interpreting results and instruct participants on the prevailing “best practices” for writing a scientific article based on Bayesian statistics. Participants will emerge from the course with knowledge about how to apply Bayesian methods to answer their research questions and with the ability to understand articles that examine and use Bayesian methods.
When? | What? | |
---|---|---|
09.00 | 12.00 | Lecture |
Lunch | ||
13:30 | 16.00 | Computer lab |
When? | Where |
---|---|
Monday | Koningsberger 224 |
Tuesday | Koningsberger 224 |
Wednesday | Koningsberger 224 |
Thursday | Koningsberger 224 |
Friday | Koningsberger 224 |
We have prepared many exercises in R
. If you are not
familiar with R, we recommend following the installation instructions
and working through the exercises below before the start of the
course.
1. Install the latest version of R
R
can be obtained
here. We won’t
use R
directly in the course, but rather call
R
through RStudio
. Therefore it needs to be
installed.
2. Install the latest RStudio
Desktop
Rstudio is an Integrated Development Environment (IDE). It can be
obtained as stand-alone software
here.
The free and open source RStudio Desktop
version is
sufficient.
3. Make sure you have a C++ compiler
We will use several packages, but mostly brms
. As
explained
here:
Because brms is based on Stan, a C++ compiler is required. The
program Rtools
(available
here
comes with a C++ compiler for Windows. On Mac, you should
install Xcode
. For further instructions on how to
get the compilers running, see the prerequisites section
here.
Exercise ‘Intro R’
If you’re not familiar with R, you might want to work on these two exercises first before continuing:
The first is a basic intro to R. By following the steps outlined in this tutorial, you will establish a fundamental understanding of R. For this exercise click here.
The second exercise guides you through frequentist regression analysis in R, building upon your foundational knowledge. For this exercise, click here.
The underlying code is available on GitHub. Your feedback (via an issue or PR) to the code or the exercises is very much appreciated!
https://posit.co/download/rstudio-desktop/#download
https://cran.r-project.org/bin/windows/Rtools/
https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started
https://www.rensvandeschoot.com/tutorials/r-for-beginners/
https://www.rensvandeschoot.com/tutorials/linear-regression-in-r-frequentist/
Day 1: we discuss the stages involved in Bayesian analysis: obtaining background knowledge from previous literature, specifying the prior distributions, and deriving the posterior. We discuss the importance of prior and posterior predictive checking, and selecting a proper technique for sampling from a probability distribution. We prepared exercises in web apps to play around with priors and data to learn how these will affect the posterior.
We adapt the course as we go. To ensure that you work with the latest iteration of the course materials, we advice all course participants to access the materials online.
Exercise ‘First Bayesian Inference’
The first exercise makes use of a Shiny App that is designed to ease its users’ first contact with Bayesian statistical inference. By “pointing and clicking”, the user can analyze the IQ example as has been used in the easy-to-go introduction to Bayesian inference of van de Schoot et al. (2014).
For the exercise click here. To get to the Shiny App click here.
The underlying code is available on GitHub. If you like the App, leave a star. Feedback (via an issue or PR) to the code or the exercise is very much appreciated!
Exercise ‘Plausible Parameter Space’
The Plausible Parameter Space (PPS) Shiny App is designed to help users define their priors in a linear regression with two regression coefficients. Users are asked to specify their plausible parameter space and their expected prior means and uncertainty around these means. The PhD-delay data is used as an easy-to-go introduction
For the exercise click here.
The underlying code is available on GitHub. If you like the App, leave a star. Feedback (via an issue or PR) to the code or the exercise is very much appreciated!
van de Schoot, R., Depaoli, S., King, R. et al. Bayesian statistics and modelling. Nature Review Methods Primers 1, 1 (2021). https://doi.org/10.1038/s43586-020-00001-2
van de Schoot, R., Kaplan, D., Denissen, J., Asendorpf, J. B., Neyer, F. J. and van Aken, M. A.G. (2014), A Gentle Introduction to Bayesian Analysis: Applications to Developmental Research. Child Dev, 85: 842–860. doi:10.1111/cdev.12169
https://www.rensvandeschoot.com/tutorials/fbi/
https://github.com/Rensvandeschoot/First-Bayesian-Inference
https://www.rensvandeschoot.com/pps
https://github.com/Rensvandeschoot/Plausible-Parameter-Space
Day 2: we discuss reproducibility and reporting standards strategies, outlining the WAMBS-checklist (when to Worry and how to Avoid the Misuse of Bayesian Statistics). We have prepared exercises in R (brms) to get hands-on experience. If you are not familiar with R, we will send you some exercises to be completed before starting the course.
We adapt the course as we go. To ensure that you work with the latest iteration of the course materials, we advice all course participants to access the materials online.
Note that the exercise requires a working version of the BRMS
packages. See the How to prepare
page if you do not have
this yet.
The first exercise goes through the When-to-Worry-and-How-to-Avoid-the-Misuse-of-Bayesian-Statistics (WAMBS) – checklist for a simple regression model. Then follows a 3 part series on how to do multilevel models in BRMS. In part 1 we explain how to build a multilevel model. In part 2 we will look at the influence of different priors and in part 3 we will go through the WAMBS checklist again.
Exercise ‘WAMBS’
This exercise leverages the power of the BRMS package in R to help users create Bayesian models and check them using the WAMBS – checklist.
For the exercise, click here.
Exercise ‘Building a Multilevel Model in BRMS’
In this exercise you go through the process of building a multilevel model. It is a practical and hands-on approach aimed at making Bayesian multilevel modeling accessible for both beginners and those with some experience.
For the exercise, click here.
Exercise ‘Influence of Priors’
This exercise is designed to make Bayesian inference more accessible for beginners. Just as in the earlier tutorial, users can engage with real-world examples to better understand the principles of Bayesian analysis.
For the exercise, click here.
Exercise ‘Multilevel WAMBS’
In this tutorial you will be following the steps of the WAMBS – checklist to analyze the cross level interaction model we did in the BRMS Tutorial.
For the exercise, click here.
Depaoli, S., & Van de Schoot, R. (2017). Improving transparency and replication in Bayesian statistics: The WAMBS-Checklist. Psychological methods, 22(2), 240.
Van de Schoot, R., Veen, D., Smeets, L., Winter, S. D., & Depaoli, S. (2020). A tutorial on using the WAMBS checklist to avoid the misuse of Bayesian statistics. Small Sample Size Solutions: A Guide for Applied Researchers and Practitioners; van de Schoot, R., Miocevic, M., Eds, 30-49.
Day 3: we discuss estimation methods including alternatives that can be more efficient when dealing with computational or non-covergence issues. A brief introduction to and the benefits of these estimation methods (MCMC, Gibbs, MH, HMC, NUTS, etc.) will be reviewed. These insights can help to understand differences between software that can be used. Additionally, we will go into prior and posterior predictive checking. These are great tools to help understand what your models and priors are implying. Today may be a little more technical (less gentle) but without equations.
We adapt the course as we go. To ensure that you work with the latest iteration of the course materials, we advice all course participants to access the materials online.
https://chi-feng.github.io/mcmc-demo/
Jonah Gabry, Daniel Simpson, Aki Vehtari, Michael Betancourt, Andrew Gelman, Visualization in Bayesian Workflow, Journal of the Royal Statistical Society Series A: Statistics in Society, Volume 182, Issue 2, February 2019, Pages 389–402, https://doi.org/10.1111/rssa.12378
Day 4: although the prior distribution can offer many advantages, the prior can also inadvertently influence the results. Today we will discuss the importance of prior sensitivity analysis to investigate the influence the prior has on the results. We will focus on models with many parameters to estimate, possibly too many for the model to be identified in a classical sense. We discuss the use of shrinkage priors to estimate these models and select substantial parameters.
We adapt the course as we go. To ensure that you work with the latest iteration of the course materials, we advice all course participants to access the materials online.
abalone.data This data is shared by Nash, Warwick, Sellers, Tracy, Talbot, Simon, Cawthorn, Andrew, and Ford, Wes. (1995). Abalone. UCI Machine Learning Repository. https://doi.org/10.24432/C55C7W.
van Erp, S. (2020). A tutorial on Bayesian penalized regression with shrinkage priors for small sample sizes. Small sample size solutions, 71-84. https://library.oapen.org/bitstream/handle/20.500.12657/22385/9780367221898_text%20(1).pdf?sequence=1#page=85
Day 5: today we elaborate on ways in which informative priors can be specified. We discuss how we can use expert knowledge and previous studies to inform these decisions. We also provide case studies and end with general reflections. In the afternoon, there will be opportunity to analyse your own data using the techniques learned during the week.
We adapt the course as we go. To ensure that you work with the latest iteration of the course materials, we advice all course participants to access the materials online.
Exercise ‘Expert Elicitation’
This exercise, using the Five-Step Method Shiny App, introduces the concept of specifying prior distributions based on eliciting expert knowledge. The participants will be guided through a comprehensive five-step method, enabling experts from diverse fields, such as academia, business, and society, to formulate their beliefs and predictions in the form of a probability distribution.
To start with the exercise, click here. To get to the Shiny App, click here. The underlying code for the exercise is readily available on GitHub.
Exercise ‘Skills showcase’
In this exercise, you will analyse your own data to showcase the skills you have learned during the week. You can find the exercise - here.
Please note: if you are participating in this course via IOPS, please email your Markdown document before September 1st, 2024 to obtain your credits.
van de Schoot R, Veen D, Grandfield EM, et al . (2021) The Use of Questionable Research Practices to Survive in Academia Examined With Expert Elicitation, PriorData Conflicts, Bayes Factors for Replication Effects, and the Bayes Truth Serum. Front Psychol. doi: 10.3389/fpsyg.2021.621547.
Veen, D., Stoel, D., Zondervan-Zwijnenburg, M., & Van de Schoot, R. (2017). Proposal for a five-step method to elicit expert judgment. Frontiers in psychology, 8, 2110. https://doi.org/10.3389/fpsyg.2017.02110.
https://www.rensvandeschoot.com/tutorials/expert-judgement/