APTS Computer-Intensive Statistics 2013

Background material

Preliminary material in PDF.
Hints, in PDF.
Step-by-step solutions, in PDF.

Material for the lectures

Lecture notes in PDF — hard copies will be handed out at Warwick.

R demonstration scripts for
simulated annealing
MCMC simulation of the Strauss process, including an introduction to CODA
slice sampling.

For animations, note the comments in the files: you will need to turn anti-aliasing off, and set the graphics device up for the fastest possible response.

Material for the labs

R script for Tuesday's computer lab CIS1.R
R script for Wednesday's computer lab CIS2.R
R script for Thursday's computer lab CIS3.R

All JAGS model files can be found in directory scripts.

Some of the parallel code may throw up a message from the firewall on Windows or Macs. You may not be able to grant the permissions it is asking about (they may need administrator privileges), but they are not actually needed (the firewall code fails to notice that it is connections to the same machine that are being used).

Software

You should have R 3.0.0 or later, although 2.15.x might suffice. We will be using the R packages LearnBayes, MCMCpack and rjags, which depend on package coda. Package rjags also requires JAGS installed. MCMCpack needs to be version 1.3-3 or later.

If you have the opportunity to use 64-bit R we suggest you do: the scripts may run appreciably faster.

Some of the code makes use of multiple cores on the computer for speed, and we will assume that you have at least two (the Warwick labs do). It is also possible to have multiple R sessions open and run computer-intensive tasks on one or more in the background.

Windows

JAGS comes in a combined version for 32- and 64-bit Windows. Download and install JAGS-3.3.0.exe.

Then install packages LearnBayes, MCMCpack and rjags from CRAN in the usual way (which will pull in coda).

Mac OS X

Download and install JAGS from http://sourceforge.net/projects/mcmc-jags/files/JAGS/3.x/Mac OS X/, then install packages LearnBayes, MCMCpack and rjags from CRAN (which will pull in coda).

(Note that JAGS is a unsigned package, so users of Mountain Lion will need to Control/right-click the .pkg, select 'Open with' then Installer and 'Open'. This currently says 3.3.0 supports Lion and Mountain Lion, but 3.1.0 is available for Snow Leopard.)

This should work with 32-bit or 64-bit R: R >= 3.0.0 is 64-bit only.

Linux

JAGS can be installed from the sources at http://sourceforge.net/projects/mcmc-jags/files/JAGS/3.x/. Also install packages LearnBayes, MCMCpack and rjags from CRAN (which will pull in coda).

There are Debian and Ubuntu packages for JAGS available: some of them are too old although 3.1.0 (as available for Ubuntu 12.04) should be OK. You might want to try

sudo apt-get install libblas-dev liblapack-dev jags
There are also packages such as r-cran-mcmcpack, but these are often not current (and MCMCpack 1.3.3 is needed, not 1.2.3).

JAGS binaries for various RPM-based distributions have been available here.

Packaging of the JAGS sources for Gentoo is available as an `ebuild' for x86 and amd64.

If you install JAGS from the sources on x86_64 Linux do read the installation manual: on RedHat/Fedora/SuSE systems you need to set libdir since the default is the (out-of-step-with-the-world as usual) Debian convention.


Last edited on 15 July 2013