Skip to main content Skip to navigation

ABS15 - 2015 Applied Bayesian Statistics School

Lab Session 1

  • Download and save the code:
    • Go to the summer school webage (http://jgill.wustl.edu/como.html) and open Example 1 Code and Example 1 Data.
    • Create a dedicated folder (e.g. ABS15) and save in there the two files with their current names (trauma.rjags.R and trauma.rjags.dat respectively).
    • Open trauma.rjags.R in RStudio and change the directory in the set working directory command, setwd("C:/Users/giacomo/Dropbox/ABS15/"), to your dedicated directory.
  • Run the code of trauma.rjags.R from RStudio (either line by line using Ctrl+Enter or all at once using the "Source" command at the top-right of the file). You may need to install some packages.
  • Once you managed to have the code running, try to change the model specification (e.g. pooled vs unpooled).
  • If time allows you can also try to use the code as a template to analyse the first examples dataset from this morning's leture http://jgill.wustl.edu/slides/como4_bw.pdf.

Some of the things you could have done in lab session 1: original file, looking at output, basic models specification.

Lab Session 2

This lab session is focused on the example from the following paper. The relevant part is from page 15 onwards (can skip the part before). First you should download Example 2 code and Example 2 data, save them in a dedicated directory (like yesterday) and change the directory in the set working directory command, setwd, to your own directory (like yesterday). Then the code should run.

Once you make this file run, you should first go through the relevant part of the paper to understand the model specification (this should take some time). Then try to extend/modify the model, for example (these are just suggestions, if you see any extension/simplification you want to do, just do it):

(a) remove the multilevel/hierarchical model specified in equation (9) of the paper and implement only a fixed effect model (using dummy variables for the US states).

(b) introduce interaction between variables in the model (think which one to use).

(c) try to analyse some state (big ones and small ones) by themselves.

(d) Perform sensitivity analysis on the prior.

Some of the things you could have done in lab session 2 (zip file).

Lab Session 3

If you have time and you want to change you can start to go to Example 3 (which we will do tomorrow).

Today we are focusing on convergence. You can use Example 3 as an example to do convergence diagnostic (first download and save code and data and run the MCMC).

(a) Perform emprirical output analysis: draw traceplots (with smoother functions), density estimations, autocorrelations and running-mean.

(b) Perform more advance diagnostic: Geweke diagnostic; Gelman&Rubin diagnostic (try 3-5-7 chains with different starting points, either chosen by you or random; look also at the multivariate version given by superdiag); and Heidelberger and Welsh.

Then move back to Example 2, which has more parameters. You should expect to need longerr runs to get convergence.