Licensed under the Creative Commons attribution-noncommercial license, Please share and remix noncommercially, mentioning its origin.

Produced using R version 4.0.2 and pomp version


This document shows how the results of He, Ionides, and King (2010) can be reproduced. Specifically, it implements the model of that paper and computes the likelihood of the data under that model. The intentions are to:

Whilst He et al. (2010) examined measles in 20 towns, we will focus on London alone. The full 20 city dataset is available on the pomp website and the MLEs obtained by He et al. (2010) for the full 20 towns are included in the R code accompanying this document.


To get started, we must install pomp if it is not already installed. The following commands install pomp from source (on github).


If we were to run into trouble in the above, we would consult the package website.

Now we'll load the packages we'll need, and set the random seed, to allow reproducibility.


Data and covariates

Now we'll load the data and covariates. The data are measles reports from 20 cities in England and Wales, digitized from the printed public records and graciously provided by Prof. Bryan Grenfell. We also have information on the population sizes and birth-rates in these cities; we'll treat these variables as covariates.

measles %>% 
  mutate(year=as.integer(format(date,"%Y"))) %>%
  filter(town==TOWN & year>=1950 & year<1964) %>%
  mutate(time=(julian(date,origin=as.Date("1950-01-01")))/365.25+1950) %>%
  filter(time>1950 & time<1964) %>%
  select(time,cases) -> dat
demog %>% filter(town==TOWN) %>%
  select(-town) -> demog

Let's plot the data and covariates.

dat %>% ggplot(aes(x=time,y=cases))+geom_line()