Bernoulli and linear regression models
With more notes on building Stan models
Welcome to the fifth workshop of the BayesCog course!
Having introduced basics of Stan with our binomial model in the previous workshop, we will now implement two new types of models: the Bernoulli model and linear regression. We will understand how the Bernoulli is linked to the binomial model, describing the same underlying process (binary outcomes) but at an individual trial level. Meanwhile, linear regression will introduce us to models with multiple parameters and continuous outcomes. In doing so, we will also build our knowledge of the Stan language further, including variable declaration, control flow and variable scope.
By the end of this workshop, you will be able to:
- Implement a Bernoulli model in Stan, and relate it to the binomial model
- Build and fit a Bayesian linear regression model in Stan
- Understand and use Stan features such as vectorization, variable declaration and scope
- Generate posterior predictive checks to validate models
Model code and R scripts for this workshop are located in the (/workshops/03.bernoulli_coin) and (/workshops/04.regression_height) directories. Set your working directory to (/workshops/03.bernoulli_coin) to begin with. Remember to use the R.proj file within each folder to avoid manually setting directories!