All the data used in the chapter are in the MARSS package. For most examples, we will use the MARSS() function to fit models via maximum-likelihood. We also show how to fit a Bayesian model using JAGS and Stan. For these sectiosn you will need the R2jags, coda and rstan packages. To run the JAGS code, you will also need JAGS installed. See Chapter 12 for more details on JAGS and Chapter 13 for more details on Stan.
library(MARSS)
library(rstan)