https://github.com/dcs-training/bayesian-statistics
Materials for the CDCS Introduction to Bayesian Statistics course. Go to the readme file
https://github.com/dcs-training/bayesian-statistics
bayesian-statistics data-analysis r statistics
Last synced: 6 months ago
JSON representation
Materials for the CDCS Introduction to Bayesian Statistics course. Go to the readme file
- Host: GitHub
- URL: https://github.com/dcs-training/bayesian-statistics
- Owner: DCS-training
- License: other
- Created: 2024-04-09T15:53:41.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-26T15:49:26.000Z (over 1 year ago)
- Last Synced: 2025-01-27T19:56:55.899Z (about 1 year ago)
- Topics: bayesian-statistics, data-analysis, r, statistics
- Language: HTML
- Homepage:
- Size: 6.94 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License.md
Awesome Lists containing this project
README
# Introduction to Bayesian Statistics
**Date**: March 2025
**Author**: Aislinn Keogh
This two-class course will introduce you to working with Bayesian Statistics. Distinct from frequentist statistics, which is concerned with accepting or rejecting the null hypothesis, Bayesian Statistics asks what the probability of different hypotheses is, given the data and our prior beliefs about the world.
On this course, we will talk through the conceptual underpinnings of Bayesian Statistics, and give you hands-on practice fitting Bayesian models in R.
Learning outcomes:
- Understand how beliefs about the world are formalised
- See how different priors influence a model's estimates
- Get to grips with interpreting posterior distributions
- Familiarise yourself with the workflow for running a Bayesian analysis
- Practise fitting and inspecting Bayesian models using the `brms` package in R
The course will be split into two sessions:
- **Week 1:** Theoretical introduction to Bayesian Statistics
- **Week 2:** Hands-on practice fitting Bayesian models in R
This is an advanced-level course. We will assume that you are comfortable using R and RStudio, and familiar with linear regression models (e.g. in `lme4`). You may want to have a quick read through the following articles to refresh your memory on some relevant theoretical concepts:
- [Basics of probability theory](https://www.khanacademy.org/math/statistics-probability/probability-library/basic-theoretical-probability/a/probability-the-basics)
- [Overview of null hypothesis significance testing](https://www.ncl.ac.uk/webtemplate/ask-assets/external/maths-resources/animal-science/hypothesis-tests/introduction-to-hypothesis-testing-and-confidence-intervals.html)
## Setup instructions
Please make sure to follow these instructions **before** the course begins as we won't have time to troubleshoot installation problems during the classes.
First, please make sure you have the latest version of [R](https://cloud.r-project.org/) and the latest version of [RStudio](https://www.rstudio.com/products/rstudio/download/#download).
### R packages
Next, you'll need to install a few R packages.
We're going to be using `brms`, which is an R interface to fit Bayesian models using a backend language called Stan.
You don't need to know anything about Stan to use `brms`, and the syntax should be very familiar if you're used to `lme4`!
The `bayesplot` package has some nice built-in functions for visualising distributions.
The `extraDistr` package includes some useful functions (density, distribution, quantile and random generation) for a number of distributions that are not available in base R.
If you don't already use `tidyverse`, you'll need to install that too; we'll be using it for general data wrangling.
Open RStudio and run the following in the Console:
```
install.packages("brms")
install.packages("bayesplot")
install.packages("extraDistr")
install.packages("tidyverse")
```
If you get any error messages for any of these installs that you can't resolve by googling, please post in the Teams chat to get help.
### C++ compiler
You'll also need a C++ compiler (because `brms` internally creates Stan code which is translated to C++ and compiled afterwards).
- **On Windows:** Install [RTools](https://cran.r-project.org/bin/windows/Rtools/rtools44/rtools.html), **ensuring that you tick the box to add RTools to the system PATH**, then run `system("g++ -v")` in the R Console
- **On macOS:** Install XCode from the App Store, then run `system("clang++ -v")` in the R Console
You should see a few lines of indecipherable system code in the Console. As long as you don't see any warnings or errors, you're good to go!
## Materials
We're going to be using this wonderful tutorial created by [Elizabeth Pankratz](https://elizabethpankratz.github.io/) for the theoretical introduction (Week 1): [Bayes, stat! (Day 1)](https://elizabethpankratz.github.io/bayes_stat/day1/learningobj.html).
Materials for the practical class (Week 2) are in the folder `practical`: you can download this entire folder to work through the RMarkdown notebook.
## Additional resources
- [Statistical Rethinking](https://xcelab.net/rm/) by Richard McElreath. This book doesn't use brms, but here's [a translation into brms + tidyverse](https://bookdown.org/content/4857/) by A Solomon Kurz.
- [An Introduction to Bayesian Data Analysis for Cognitive Science](https://vasishth.github.io/bayescogsci/book/) by Bruno Nicenboim, Daniel Schad, and Shravan Vasishth.
- [A Student's Guide to Bayesian Statistics](https://uk.sagepub.com/en-gb/eur/book/student%E2%80%99s-guide-bayesian-statistics) by Ben Lambert.
## Feedback
If you attended this course in March 2025, please fill in our [feedback form](https://forms.office.com/r/YYNrqvuNr8).
[](https://creativecommons.org/licenses/by-nc/4.0/)