Bayesian inference with mathematical models
Mechanistic models: description vs mechanism.
Given a model, what are the parameter combinations that best fit the data?
Given what we observe, what is the state of the system?
Often we know something about how the data were taken, so observations introduce uncertainty.
We can express the uncertainty in observing the process as a probability
Including this in our model gives
How many soldiers die of horse kicks, at 0.61 deaths per corps per year? Counts of rare, independent events follow a Poisson distribution.
What will the temperature be in London tomorrow? A continuous quantity, here a normal distribution.
SIR model, assuming cases are detected with reporting probability , and that observations are conditionally independent given the trajectory: knowing the model, one day’s error tells us nothing about the next.
At time 10, 18 cases observed.
In the model, 31.1 cases.
Multiply across the data to get the probability of the whole trajectory:
Or sum on the log scale, which is numerically better behaved:
We compare models to data using probabilities:
For a given model this depends on the parameters :
is called the likelihood of parameters . Here encompasses all parameters, e.g. .
Likelihoods can span a wide range of orders of magnitude, which causes numerical problems. Taking the logarithm gives the log-likelihood.
In Bayesian inference we need . Applying the rule of conditional probabilities:
In words,
is our belief about the parameters before we see the data, taken from previous measurements, the literature, or experts.
A prior for the of measles
A prior on is hard to have intuition about. An epidemic curve is not.
So draw parameters from the prior, run the model, and look at what you get. This is a prior predictive simulation, and it turns an abstract claim into a picture you can judge.
If your prior produces epidemics that infect the whole population in four days, you have learned something you could not have seen from the parameter range.
Parameters are interpreted as a random variable, distributed according to the posterior:
We want to generate samples of from this distribution.
You can explore a two-parameter posterior on a grid. Fifteen values each is 225 model runs, which is nothing.
| Parameters | Grid points at 15 each |
|---|---|
| 2 | 225 |
| 4 | 50,625 |
| 6 | 11,390,625 |
| 10 | 576,650,390,625 |
So a grid is a good way to look at a posterior in two dimensions, and no way at all to fit a model with six parameters. The next session is about what to do instead.
Bayesian inference