Introduction to Bayesian Data Analysis

Bayesian data analysis is increasingly becoming the tool of choice for many data-analysis problems.

This free course on Bayesian data analysis will teach you basic ideas about random variables and probability distributions, Bayes' rule, and its application in simple data analysis problems. You will learn to use the R package brms (which is a front-end for the probabilistic programming language Stan). The focus will be on regression modeling, culminating in a brief introduction to hierarchical models (otherwise known as mixed or multilevel models).

This course is appropriate for anyone familiar with the programming language R and for anyone who has done some frequentist data analysis (e.g., linear modeling and/or linear mixed modeling) in the past.

Self-paced since March 13, 2023
Language: English
Advanced, Beginner, Big Data and AI

Course information

Introduction: Why are Bayesian methods important for data analysts?

Here are some of the advantages of Bayesian methods over the standard frequentist approach used in data analysis:

  • Prior knowledge/expertise can be incorporated into the data analysis
  • Models can be flexibly specified to reflect the assumed generative process
  • The results of the analysis – the posterior distributions of the parameters of interest – have an intuitive interpretation
  • Hypothesis testing can be carried out in a more meaningful manner than the standard used null hypothesis significance testing

Prerequisites: Who is this course for?

We assume the following in this course:

  • Basic familiarity with the programming language R, openHPI offers a free R course for Beginners (in German)
  • Experience with data analysis using linear models
  • It is helpful (but not necessary) to have had some exposure to linear mixed models using the R library lme4
  • High-school mathematics (pre-calculus)
  • Some basic concepts from probability theory (sum and product rule, conditional probability)

This course is not appropriate for participants who don't know R programming and who have no experience at all with data analysis.

Course outcomes: What will you learn from this course?

  • Some basic ideas relating to random variables
  • Some fundamental properties of probability distributions
  • Application of Bayes' rule in data analysis
  • The concept of likelihood and its role in Bayesian statistical modeling
  • Bayesian regression models using brms (a front-end for Stan)
  • How to visualize and interpret prior and posterior distributions
  • How to generate prior and posterior predictive distributions for evaluating models
  • How to interpret the results of simple regression models

After completing this course, you will be in a good position to learn how to use more advanced Bayesian methods, such as hierarchical models, finite mixture models, multinomial processing tree models, measurement error models, etc.

Course structure: How do you plan this course?

This four-week course consists of

  • A series of weekly video lectures
  • Self-tests, weekly homework, and programming tasks
  • Supplementary reading materials

We expect a weekly time commitment of 5-10 hours to complete the course, depending on your prior knowledge.

Recommended reading: Textbook

The course follows the structure of an online textbook, which will be published by CRC Press soon. You can view the textbook here.

What you'll learn

  • Bayesian statistics
  • Data analysis
  • Bayesian regression models using brms

Who this course is for

  • Students
  • Researchers
  • Data Analysts
  • Scientists
  • Anyone who wishes to do data analysis

Course contents

  • Week 0 - Initial Setup:

    Please install the latest versions of R and RStudio, rstan, brms, and other necessary packages in R. In order to get the most out of this course, please read the textbook chapters 1-4 (the textbook link is provided below) as the course progresses. Each chapter belongs to the corresponding week in this course.
  • Week 1 - Introduction:

    Learn the foundational ideas about random variables and probability distributions. Reading: Chapter 1 of the textbook.
  • Week 2 - Bayesian data analysis:

    Understand Bayes' rule, derive the posterior using Bayes' rule; visualize the prior, likelihood, and posterior; distinguish between the prior, likelihood, and posterior; incorporate prior knowledge into the analysis. Reading: Chapter 2.
  • Week 3 - Computational Bayesian data analysis:

    Derive the posterior through sampling; build a simple linear regression model using brms; visualize prior predictive distributions, perform sensitivity analysis and posterior predictive checks. Reading: Chapter 3.
  • Week 4 - Bayesian regression and hierarchical models:

    Perform simple linear regressions using the normal and binomial likelihoods to answer the following research questions: (i) Does attentional load affect pupil size? (ii) Does trial id affect response times? (iii) Does set size affect recall accuracy? Take a brief look-ahead at linear mixed models. Reading: Chapter 4 and up to section 5.3 of Chapter 5.
  • Final Exam:

    Final Exam
  • I like, I wish:

    Please provide your feedback on the course.

Enroll me for this course

The course is free. Just register for an account on openHPI and take the course!
Enroll me now


Course End
Mar 13, 2023
Course Start
Jan 25, 2023


This course was rated with 4.15 stars in average from 303 votes.

Certificate Requirements

  • Gain a Record of Achievement by earning at least 50% of the maximum number of points from all graded assignments.
  • Gain a Confirmation of Participation by completing at least 50% of the course material.

Find out more in the certificate guidelines.

This course is offered by

Prof. Dr. Shravan Vasishth

Shravan Vasishth is professor of linguistics at the University of Potsdam, Germany. His background is in Statistics, Computer Science, Linguistics, and Japanese. He is a chartered statistician with the Royal Statistical Society, UK. For more details about him and his research, see

Dr. Anna Laurinavichyute

I am a cognitive scientist with a PhD in cognitive science from the University of Potsdam, Germany. I am interested in data science and computational cognitive modeling.