This chapter presents a series of astronomical applications using some of the models presented earlier in the book. Each section concerns a specific type of astronomical data situation and the associated statistical model. The examples cover a large variety of topics, from solar (sunspots) to extragalactic (type Ia supernova) data, and the accompanying codes were designed to be easily modified in order to include extra complexity or alternative data sets. Our goal is not only to demonstrate how the models presented earlier can impact the classical approach to astronomical problems but also to provide resources which will enable both young and experienced researchers to apply such models in their daily analysis.
Following the same philosophy as in previous chapters, we provide codes in R/JAGS and Python/Stan for almost all the case studies. The exceptions are examples using type Ia supernova data for cosmological parameter estimation and approximate Bayesian computation (ABC). In the former we take advantage of the Stan ordinary differential equation solver, which, at the time of writing, is not fully functional within PyStan. Thus, we take the opportunity to show one example of how Stan can also be easily called from within R. The ABC approach requires completely different ingredients and, consequently, different software. Here we have used the cosmoabc Python package in order to demonstrate how the main algorithm works in a simple toy model. We also point the reader to the main steps towards using ABC for cosmological parameter inference from galaxy cluster number counts. This is considered an advanced topic and is presented as a glimpse of the potential of Bayesian analysis beyond the exercises presented in previous chapters. Many models discussed in this book represent a step forward from the types of models generally used by the astrophysical community. In the future we expect that Bayesian methods will be the predominant statistical approach to the analysis of astrophysical data.
For all the examples presented in this chapter we will use publicly available astronomical data sets. These have been formatted to allow easy integration with our R and Python codes. All the code snippets in this chapter contain a path_to_data variable, which has the format path_to_data = ”˜ <some path>”, where the symbol ˜ should be substituted for the complete path to our GitHub repository.