APTS Computer-Intensive Statistics 2011

Background material

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

Material for the lectures and labs:
Lecture notes in PDF.
R script for Tuesday's computer lab CIS1.R.
R script for Wednesday's computer lab CIS2.R and a version using OpenBUGS: CIS2-BRugs.R
R script for Thursday's computer lab CIS3.R and a version using OpenBUGS: CIS3-BRugs.R

A zip of all the scripts, including JAGS model files.

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.

Software

One of the bootstrapping examples in the first lab makes use of a feature of R 2.13.0 (for speed), so you should preferably have that (or R 2.13.0 patched). We will be using the R packages LearnBayes and MCMCpack, which depend on package coda. We will also be making use of the R package rjags (and optionally BRugs) as an example of the interfaces to the BUGS family of languages.

Windows (32- and 64-bit)

JAGS comes in separate versions for 32- and 64-bit Windows, and you need to install the one appropriate to the version of R (not Windows) that you use. So for 32-bit R download and install JAGS-2.2.0-win32.exe: for 64-bit R download and install JAGS-2.2.0-win64.exe.

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

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

If you would like to experiment with parallel computation install package snow and update package boot to at least version 1.3-2.

Mac OS X

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

This should work with 32-bit or 64-bit R (and even with PowerPC Mac OS 10.5). 64-bit R will often run the bootstrapping scripts appreciably faster, if you have the choice (it is installed as R64.app and R64 at the command line on reasonably recent Macs).

If you would like to experiment with parallel computation install package multicore and update package boot to at least version 1.3-2.

Linux

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

There are Debian and Ubuntu packages for JAGS available, but some of them are too old: you need JAGS 2.1.0 or preferably 2.2.0. NB: some people report missing dependencies: you might want to try

sudo apt-get install libblas-dev liblapack-dev jags

JAGS binaries for various RPM-based distributions are available here (but the site seems often to be down).

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.

If you would like to experiment with parallel computation install package multicore and update package boot to at least version 1.3-2.

OpenBUGS

Some of you may want to experiment with OpenBUGS via R package BRugs, which is what was used in earlier years.

OpenBUGS is primarily a 32-bit program, and on Windows it can only (at present) be used with 32-bit R (running on 32- or 64-bit Windows).

You will need to first download the Windows' installer for OpenBUGS and run it. Then download BRugs_0.7.1.zip and install that (as a 'local zip file' from the packages menu in Rgui).

If you are running ix86 Linux (or x86_64 Linux and have installed 32-bit compiler support) you can install OpenBUGS 3.2.1 from http://www.openbugs.info/w/Downloads and the source R package BRugs from http://www.openbugs.info/w/UserContributedCode. Unlike earlier versions of OpenBUGS on Linux, this seems fairly stable (and the OpenBUGS versions of the computer exercises have been tested on x86_64 Fedora 14).


Last edited on 01 July 2011