This is the GitHub repo for the Thursday seminar materials for the course Bayesian Data Analysis.
In total there are three Thursday seminars, each covering and extending content covered in the corresponding week, with a particular focus on practical application using R. For each seminar, there is a corresponding folder in this repo with all the materials used in that seminar. This includes a PDF of the slides used, the Jupyter notebook files and corresponding R scripts. Please feel free to borrow and rework any of the featured code in future work.
In the seminars, I will be presenting using a Jupyter notebook using an R kernel with Visual Studio Code. Reading and operating a Jupyter notebook offline will require installation of Python and executing cells with an R kernel requires more setup. However, you should be able to at least read the notebooks via GitHub on your browser.
Email: matthew.fisher@newcastle.ac.uk
The following is a list of useful links:
- Prior Specification Recommendation: An assortment of prior recommendations for different models. It is a bit of a mess, but there is likely some useful advice there if you are struggling in specifying priors.
- Advanced Statistical Computing: An online book written with
Rfocussing on statistical computation. The relevant material here is the section of Markov Chain Monte Carlo. Other sections demonstrate other computational techniques. - Statistical Computing for Biologists: An online
Rcourse intended for graduate level biologists. The course is really just statistical computing. The relevant material are the introduction toggplotanddplyr. - JAGS User Manual: If you really want to know all the inner workings of JAGS, the user manual covers pretty much everything.
- Resources for "A Students Guide to Bayesian Statistics": Website of the book "A Student's Guide to Bayesian Statistics". Features videos corresponding to each chapter as well as solutions to problem sets. Unfortunately, all the videos are not complete.
- R for Data Science: Website of the book "R for Data Science". Excellent resource for basics of
R.
This guide covers the bare essential requirements for running the JAGS. These requirements should already be setup on university machines. All we require are installations of R, RStudio, JAGS and some R packages:
- Install the latest version of
Rfor your operating system. - Install the free version of RStudio: RStudio Desktop, Open Source Edition.
- Install the latest version of JAGS for your operating system. JAGS should automatically link to
Rand you should be ready to go. - In an
Rterminal or in the terminal of RStudio, installrjagsandcodawith the commandsinstall.packages(rjags)andinstall.packages(coda). To load the libraryrjags, you may have to restart yourRinstance.
Note that R and JAGS may also be available on package managers. For instance, if you are using MacOS, they are both available on homebrew.
If you are using Apple Silicon, it is slightly more difficult to install and use JAGS. There are various options, although I recommend the following:
- Install the arm64 version of
R. This is available here. - Ensure you have
homebrewinstalled. - In a terminal, install using
homebrew, the packagesJAGSandpkg-configusing the commandsbrew install pkg-configandbrew install jags. - In
R, installrjagsusinginstall.packages("rjags", type = "source"). If you don't usetype = "source",rjagswill not be loadable. To fix this, just uninstallrjagsusingremove.packages("rjags")and reinstalling.