17.1 Introduction
In this chapter, we will follow along with the case example from Chapter 12 that examined a behavioral choice made by Atlantic salmon smolts while they migrated from streams to the ocean.
We’ll work with some packages from the tidyverse
, rstan
, and rstanarm
, and we’ll use the StillwaterChoice
data from the class data folder. You can go ahead and load those whenever you are ready to get started.
You can also set up some options for Stan right up front. Here I am telling rstan not to compile a model everytime I run one that is already compiled, and I am setting an option that tells R to detect the number of virtual “cores” on my computer so it can run models in parallel to speed things up. This means that instead of sampling all my Markov Chains serially one at a time I can sample each of them on a separate process on my computer.