MLwiN Files for 'Disease Mapping with WinBUGS and MLwiN'

Some brief comments on the files available here

On this page we present the worksheets and macros that are used in the sections of the book that deal with the MLwiN software package. The MLwiN software package differs from the WinBUGS package in several ways. First it contains maximum likelihood (ML), quasilikelihood (QL) and Bayesian (MCMC) methods for fitting many of the models. Second there is a difference in how starting values for the MCMC methods are obtained. In WinBUGS the model is self-contained, and there is a section in the model code that contains the initial values for each unknown parameter. This means that running a particular analysis can easily be repeated and the same answers obtained. In MLwiN the modelling process is more organic with a worksheet containing a dataset to which many models will be fitted sequentially with one or more estimation methods. For each model the starting values, in particular for the MCMC estimation procedure, are derived from the last model run (which is often the same model run using an ML or QL method). This means that the starting values depend both on the sequence of previous models fitted and even whether the ML/QL methods were run using the 'Start' button (which effectively starts from scratch) or the 'More' button (which starts from the previous model estimates). Of course performing exactly the same model fitting order and methods will give identical estimates for each model but it is very easy to change order slightly and sometimes we are not specific in the book which order we have fitted the models in, or which method we used to generate starting values. The different starting values will not be that noticeable if we simply view the values themselves as generally they vary in only a 4th or 5th digit. However due to the number of iterations that are run in the MCMC estimation methods and in particular the number of reject/accept decisions in the Metropolis-Hastings algorithm starting from two very close starting points may produce very different Markov chains. Of course all these chains are supposed to converge to the same stationary distribution so running for long enough will give very close if not identical answers but given the timing constraints on some of the poor mixing models if we haven't run the chains for long enough we may get some slightly different estimates. This will in fact show the value and importance of MCMC convergence diagnostics and it is good practice to run the same model with different starting values. However we appreciate that many readers would prefer to get the same estimates and so we apologise for slight inconsistancies. One final point to note is that this book was written during the development period of MLwiN version 2.0. As this version contains many new features and particularly more spatial modelling features than the previous version 1.1 it was felt essential to use the new version. As we write this, the version 2.0 is available for Beta testing before full release and this has unfortunately slightly delayed the practical use of the book for a short period. There has also been a slight change to the macros used for the QL estimation of Poisson models which as a result means that the MCMC estimates in chapter 5 will DEFINITELY be slightly different in practice to those in the book. However this page contains a copy of the old macro here for readers who wish to replicate the analysis exactly. We hope the above points will not diminish the readers use of the book and software package.

MLwiN worksheets and macros

Old Macro for Poisson models

macro file: Pre_0 This file can be put in the 'discrete' subdirectory where MLwiN is installed. Note that it is best to copy the existing macro file 'Pre_0' to 'Pre_0.bak' so it can be retrieved.

Chapter 5

mmmec.txt Text file for melanoma dataset. MLwiN worksheet for Scottish lip cancer dataset.

Chapter 6 Initial MLwiN worksheet for Ohio respiratory cancer dataset. Later MLwiN worksheet for Ohio respiratory cancer dataset.

Chapter 7 MLwiN worksheet for Falkirk respiratory cancer dataset.

Chapter 8 MLwiN worksheet for South Carolina cancer dataset. MLwiN worksheet for South Carolina low birth weight dataset. MLwiN worksheet for East German lip cancer dataset.

Chapter 9

The dataset in Chapter 9 is unfortunately not available for general distribution although hopefully the chapter example is useful to people with similar data. The macro below may be adapted for other datasets.

iowa.txt Macro file for Iowa survival analysis dataset.


On page 143 when viewing the data the year column will have the 10 years labelled 'exp79' - 'exp88' rather than as shown in the book. This is a bug in MLwiN which has set the column to be categorical. To fix this, at this point select the Names window. Click on Categories and on the window that appears click on the clear button. The rest of the chapter should then be OK.

Return to: William Browne's Homepage