Workshop on Bayesian Inference: Priors and workflow
Chapter 1 Introduction
Here you can find the video lectures and exercises for our 2022 workshop on Bayesian inference. The workshop assumes a minimal statistical literacy (e.g. having used t-tests and correlations). The workshop is specifically aimed to Bayes-curious students and researchers worried about having to set priors and/or other supposedly subjective choices in Bayesian analyses. Accordingly the workshop focuses on setting up a rigorous Bayesian workflow for your analysis and provides much discussion of how to define and assess priors.
The lectures are recordings of a workshop given on January 6th-7th 2022 to the Embodied Computation Group and the Body, Pain & Perception Lab at Aarhus University.
The materials change every time we teach the workshop as we keep learning, so any feedback is very welcome. If you notice mistakes, imprecisions, or have suggestions for improvement, add an issue to github (https://github.com/4CCoxAU/PriorsWorkshop) or send us a mail :-)
The code relies on R, Rstudio, Brms and Stan.
The instructors are:
Christopher Cox is a Phd student at Aarhus University and University of York, researching how infants learn their first language, with a special interest in their active and interactive role in shaping their linguistic environment. While less visible in the videos, Chris prepared all the materials and website and should receive most of the kudos!
Riccardo Fusaroli (https://firstname.lastname@example.org), an associate professor in Cognitive Science at Aarhus University, researching how social interactions work and fail, and trying to figure out how we can build better cumulative and self-critical scientific approaches.
1.1 Structure of this Workshop
After an introduction to the rationale behind this workshop, the video lectures showcase and explain a step-by-step Bayesian workflow in setting up a concrete Bayesian analysis (of whether native speakers of Danish speak more or less clearly to their children compared to adults). The actual content of the course is organized in 4 separate sections:
- Modeling your outcome: Intercepts-only Model;
- Introducing a predictor: Simple Linear Regression;
- Acknowledging repeated measures: Multi-level Modelling;
- Acknowledging previous findings: Comparative Assessment of Informed Priors.
For each section, you will find a video lecture (building on the previous sections) and a step-by-step commented script showing how to implement the conceptual steps from the lecture in R/brms/Stan.
We strongly recommend you watch a video, download the markdown (and data) and go through the code, fitting the models, and answering the questions, instead of just quickly browsing the webpage with the code and output.
Here you can download a .zip file with all of the Rmarkdown files and data:
And here is the full playlist of videos:
https://youtu.be/_7hlAJ6eWI4 (Introduction I, 9 min, 34 secs)
https://youtu.be/SIgxZ-u1s3A (Introduction II, 18 min, 29 secs)
https://youtu.be/j1yxeRqJ0es (Modeling your Outcome, 32 min, 4 secs)
https://youtu.be/7tGixoOdW5U (Introducing a Predictor, 29 min, 14 secs)
https://youtu.be/yUs4LB_9KWw (Acknowledging Repeated Measures I, 7 min, 1 sec)
https://youtu.be/A1osWXChYr8 (Acknowledging Repeated Measures II, 45 min, 34 secs)
https://youtu.be/zBEiugiqbd4 (Acknowledging Previous Findings, 27 min, 56 secs)
Here is what you will need for this workshop:
up-to-date R (version 4 or above) and Rstudio (version 1.3 or above) installed and working. See here for a more detailed instruction on how to install R and Rstudio: https://happygitwithr.com/install-r-rstudio.html
the “brms” package installed: https://github.com/paul-buerkner/brms N.B. it’s not always as simple as doing an install.packages(“brms”), so do follow the linked guide!
If you are already comfortable with using R and stats, we also recommend you install the “cmdstanr” package (which makes fitting models go faster, but is not necessary for the course, nor easy to install): https://mc-stan.org/cmdstanr/articles/cmdstanr.html N.B. it’s not always as simple as doing an install.packages(“cmdstanr”), so do follow the linked guide!
Without these packages working, you will not be able to tackle the following practical exercises, so do install them before you move to the next section and make sure there are no errors or worrying warnings.
Once your computer is ready, you should also get your brain ready. This workshop focuses on how to do Bayesian data analysis and does not go into the details of Bayes’ theorem. If you are not familiar with the theorem or need a quick refresh, we strongly recommend you give this 15 min video a watch before the workshop. This should make talk of priors and posteriors much easier to parse. https://www.youtube.com/watch?v=HZGCoVF3YvM
Before starting with the full-on content on Bayesian Data analysis, we recommend you also watch the following introductory videos to the workshop.
1.3 Introductory Video
This first video provides an introduction to the course instructors and outlines the structure of the workshop:
1.4 Video on Bayesian inference
This second video starts with a soft introduction to the basic concepts of Bayesian inference, tackles some common worries, and provides an overview of the data analysed throughout the course: