The University of Sheffield

sorry, we can't preview this file

MHcalibrationexample_18Sept12.xlsm (440.92 kB)

Metropolis Hastings Calibration Excel Example

Download (440.92 kB)
posted on 2021-10-11, 14:33 authored by Sophie WhyteSophie Whyte
This spreadsheet is intended as an example to demonstrate how the Metropolis Hastings algorithm can be implemented within microsoft Excel to undertake Bayesian inference.
If you are considering programming the Metropolis Hastings algorithm in another language/modelling package this example may be useful for you.
This example uses a very simple state transition model (with 3 states) and uses data observations of persons in State B and persons moving to Stage C.
This structure and approach can be extended to a larger more complex model and with more parameters and datasets.
This spreadsheet may be a useful illustration of the process of the MH algorithm for those considering programming this algorithm in another package.
Warning! This example is intended as a rough guide to the process only. For further details consult a statistics reference.
The author has used a similar approach to calibrate a natural history model for colorectal cancer. The methods are published here:
Whyte S, Walsh C, Chilcott J. Bayesian Calibration of a Natural History Model with Application to a Population Model for Colorectal Cancer. Medical Decision Making 2011;31:625-641.


UK National Cancer Screening



  • There is no personal data or any that requires ethical approval


  • The data complies with the institution and funders' policies on access and sharing

Sharing and access restrictions

  • The data can be shared openly

Data description

  • The file formats are open or commonly used

Methodology, headings and units

  • There is a file including methodology, headings and units, such as a readme.txt