Importance sampling for partially observed temporal epidemic models


We present an importance sampling algorithm that can produce realisations of Markovian epidemic models that exactly match observations, taken to be the number of a single event type over a period of time. The importance sampling can be used to construct an efficient particle filter that targets the states of a system and hence estimate the likelihood to perform Bayesian inference. When used in a particle marginal Metropolis Hastings scheme, the importance sampling provides a large speed-up in terms of the effective sample size per unit of computational time, compared to simple bootstrap sampling. The algorithm is general, with minimal restrictions, and we show how it can be applied to any continuous-time Markov chain where we wish to exactly match the number of a single event type over a period of time.

This is a preview of subscription content, log in to check access.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5


  1. 1.

    Also known as the Gillespie algorithm or the Doob-Gillespie algorithm.

  2. 2.

    In fact this can be done analytically for this model.

  3. 3.

    This condition may not be true after the final observed infection event, depending on what other observations are made on the system afterwards.


  1. Aho, A.V., Ullman, J.D.: Foundations of Computer Science. W. H. Freeman and Company, New York (1995)

    Google Scholar 

  2. Anderson, D.F.: A modified next reaction method for simulating chemical systems with time dependent propensities and delays. J. Chem. Phys. 127, 214107 (2007)

    Article  Google Scholar 

  3. Andrieu, C., Doucet, A., Holenstein, R.: Particle Markov chain Monte Carlo methods (with discussion). J. R. Stat. Soc. B 72, 269–342 (2010)

    MathSciNet  Article  Google Scholar 

  4. Black, A.J., Geard, N., McCaw, J.M., McVernon, J., Ross, J.V.: Characterising pandemic severity and transmissibility from data collected during first few hundred studies. Epidemics 19, 61–73 (2017)

    Article  Google Scholar 

  5. Black, A.J., McKane, A.J.: Stochastic formulation of ecological models and their applications. Trends Ecol. Evol. 27, 337–345 (2012)

    Article  Google Scholar 

  6. Black, A.J., Ross, J.V.: Estimating a Markovian epidemic model using household serial interval data from the early phase of an epidemic. PLoS ONE 8, e73420 (2013)

    Article  Google Scholar 

  7. Black, A.J., Ross, J.V.: Computation of epidemic final size distributions. J. Theor. Biol. 367, 159–165 (2015)

    Article  Google Scholar 

  8. David, H.A., Nagaraja, H.N.: Order Statistics, 3rd edn. Wiley, New York (2005)

    Google Scholar 

  9. Del Moral, P., Jasra, P., Lee, A., Yau, C., Zhang, X.: The alive particle filter and its use in particle Markov chain Monte Carlo. Stoch. Anal. Appl. 33, 943–974 (2015)

    MathSciNet  Article  MATH  Google Scholar 

  10. Doucet, A., de Freitas, N., Gordon, N.J. (eds.): Sequential Monte Carlo Methods in Practice. Springer, New York (2001)

  11. Doucet, A., Johansen, A.M.: A tutorial on particle filtering and smoothing: fifteen years later. Handb. Nonlinear Filter. 12(656–704), 3 (2009)

    MATH  Google Scholar 

  12. Doucet, A., Pitt, M.K., Deligiannidis, G., Kohn, R.: Efficient implementation of Markov chain Monte Carlo when using an unbiased likelihood estimator. Biometrika 102, 295–313 (2015).

    MathSciNet  Article  MATH  Google Scholar 

  13. Drovandi, C.C.: Pseudo-marginal algorithms with multiple CPUs (2014).

  14. Drovandi, C.C., McCutchan, R.A.: Alive SMC\(^2\): Bayesian model selection for low-count time series models with intractable likelihoods. Biometrics 72, 344–353 (2016)

    MathSciNet  Article  MATH  Google Scholar 

  15. EpiStruct.: (2017).

  16. Gibson, G.J., Renshaw, E.: Estimating parameters in stochastic compartmental models using Markov chain methods. Math. Med. Biol. 15, 19–40 (1998).

    Article  MATH  Google Scholar 

  17. Gibson, M.A., Bruck, J.: Efficient exact stochastic simulation of chemical systems with many species and many channels. J. Phys. Chem. A 104, 1876–1889 (2000)

    Article  Google Scholar 

  18. Gillespie, D.T.: A general method for numerically simulating the stochastic time evolution of coupled chemical reactions. J. Comput. Phys. 22, 403–434 (1976)

    MathSciNet  Article  Google Scholar 

  19. Golightly, A., Kypraios, T.: Efficient SMC\(^2\) schemes for stochastic kinetic models. Stat. Comput. (2017).

  20. Golightly, A., Wilkinson, D.J.: Bayesian parameter inference for stochastic biochemical network models using particle Markov chain Monte Carlo. Interface Focus 1, 807–820 (2011).

    Article  Google Scholar 

  21. Gordon, N.J., Salmond, D.J., Smith, A.F.M.: Novel approach to nonlinear/non-Gaussian Bayesian state estimation. IEE Proc. F 140, 107–113 (1993)

    Google Scholar 

  22. Jenkinson, G., Goutsias, J.: Numerical integration of the master equation in some models of stochastic epidemiology. PLoS ONE 7, e36160 (2012)

    Article  Google Scholar 

  23. Jewell, C.P., Kypraios, T., Neal, P., Roberts, G.O.: Bayesian analysis for emerging infectious diseases. Bayesian Anal. 4, 465–496 (2009).

    MathSciNet  Article  MATH  Google Scholar 

  24. Keeling, M.J., Rohani, P.: Modeling Infectious Diseases in Humans and Animals. Princeton University Press, Princeton, NJ (2007)

    Google Scholar 

  25. Knuth, D.: The Art of Computer Programming, vol. 1. Addison-Wesley, Reading, MA (1997)

    Google Scholar 

  26. Kroese, D.P., Taimre, T., Botev, Z.I.: Handbook of Monte Carlo Methods. Wiley, New York (2011)

    Google Scholar 

  27. Lau, M.S.Y., Cowling, B.J., Cook, A.R., Riley, S.: Inferring influenza dynamics and control in households. Proc. Natl. Acad. Sci. 112, 9094–9099 (2015)

    Article  Google Scholar 

  28. McKinley, T.J., Ross, J.V., Deardon, R., Cook, A.R.: Simulation-based Bayesian inference for epidemic models. Comput. Stat. Data Anal. 71, 434–447 (2014).

    MathSciNet  Article  MATH  Google Scholar 

  29. O’Neill, P.D., Roberts, G.O.: Bayesian inference for partially observed stochastic epidemics. J. R. Stat. Soc. A 162, 121–130 (1999).

    Article  Google Scholar 

  30. Pitt, M.K., Silva, R., Giordani, P., Kohn, R.: On some properties of Markov chain Monte Carlo simulation methods based on the particle filter. J. Econom. 171, 134–151 (2012).

    MathSciNet  Article  MATH  Google Scholar 

  31. Pooley, C.M., Bishop, S.C., Marion, G.: Using model-based proposals for fast parameter inference on discrete state space, continuous-time Markov processes. J. R. Soc. Interface 12, 20150225 (2015)

    Article  Google Scholar 

  32. Regan, D.G., Wood, J.G., Benevent, C., et al.: Estimating the critical immunity threshold for preventing hepatitis a outbreaks in men who have sex with men. Epidemiol. Infect. 144, 1528–1537 (2016).

    Article  Google Scholar 

  33. Roh, M.K., Gillespie, D.T., Petzold, L.R.: State-dependent biasing method for importance sampling in the weighted stochastic simulation algorithm. J. Chem. Phys. 133, 174106 (2010)

    Article  Google Scholar 

  34. Sherlock, C., Thiery, A.H., Roberts, G.O., Rosenthal, J.S.: On the efficiency of pseudo-marginal random walk metropolis algorithms. Ann. Stat. 43, 238–275 (2015)

    MathSciNet  Article  MATH  Google Scholar 

  35. Stockdale, J.E., Kypraios, T., O’Neill, P.D.: Modelling and bayesian analysis of the Abakaliki smallpox data. Epidemics 19, 13–23 (2017).

    Article  Google Scholar 

  36. van Kampen, N.G.: Stochastic Processes in Physics and Chemistry. Elsevier, Amsterdam (1992)

    Google Scholar 

  37. Walker, J.N., Ross, J.V., Black, A.J.: Inference of epidemiological parameters from household stratified data. PLoS ONE 12, e0185910 (2017)

    Article  Google Scholar 

Download references


This research was supported by an ARC DECRA fellowship (DE160100690). AJB also acknowledges support from both the ARC Centre of Excellence for Mathematical and Statistical Frontiers (CoE ACEMS), and the Australian Government NHMRC Centre for Research Excellence in Policy Relevant Infectious diseases Simulation and Mathematical Modelling (CRE PRISM\(^2\)). Supercomputing resources were provided by the Phoenix HPC service at the University of Adelaide. AJB would also like to thank Joshua Ross and James Walker for comments on an earlier draft of the manuscript.

Author information



Corresponding author

Correspondence to Andrew J. Black.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Electronic supplementary material

Below is the link to the electronic supplementary material.

Supplementary material 1 (pdf 72 KB)

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Black, A.J. Importance sampling for partially observed temporal epidemic models. Stat Comput 29, 617–630 (2019).

Download citation


  • Importance sampling
  • Markov chain
  • Epidemic modelling
  • Particle filter