In theory the process of Bayesian inference is straightforward. After specifying a complete Bayesian model we condition the joint distribution over model configurations and observed data on a particular measurement and then quantify inferences with the resulting posterior expectation values. This theoretical elegance, however, rarely carries over into practice. Reasoning about sophisticated models is certainly challenging, and explicitly specifying and communicating those models is even more difficult. Moreover, even if we can precisely define our model then we have to struggle to accurately estimate the corresponding posterior expectation values.
Stan is a comprehensive software ecosystem aimed at facilitating the application of Bayesian inference. It features an expressive probabilistic programming language for specifying sophisticated Bayesian models backed by extensive math and algorithm libraries to support automated computation. This functionality is then exposed to common computing environments, such as R, Python, and the command line, in user-friendly interfaces.
In this case study I present a thorough introduction to the Stan ecosystem with a particular focus on the modeling language. After a motivating introduction we will review the Stan ecosystem and the fundamentals of the Stan modeling language and the RStan interface. Finally I will demonstrate some more advanced features and debugging techniques in a series of exercises.
The hope is that with a strong foundational understanding you too will be asking for more Stan.