## Modelling An Epidemic

Two and a half years ago, when I read the research interests of my statistics prof, I noticed that he had become interested in analyzing epidemiological models. Now, I might finally understand what he was talking about.

If we let S be the population of individuals who are susceptible to the disease, I be the population infected with it and R the population that has recovered, it is not too big a stretch to say that this plot appears to follow the progression of a non-lethal disease. Only a small number of people have the disease at the beginning, but this number grows because the disease is contagious. People who have recovered are immune to further infection meaning that the epidemic eventually dies out.

This is called an SIR-model for obvious reasons, and it is one of several compartmental models in mathematical epidemiology, developed by Kermack and McKendrick. The plot was made by numerically solving three coupled differential equations - one for each compartment. These models are of course idealized versions of the truth. Depending on what you read on the subject, you might see papers where the authors just assume that a bunch of differential equations hold. What I will try to do is motivate the assumptions that lead to this model in slightly more elegant terms.

First, we assume that all individuals in a given compartment are identical. This allows our differential equations to be ordinary differential equations. For example, the number of infected individuals only needs to be evaluated at time - . Some more complicated models would use telling us how many age infected individuals exist at location as a function of time.

The second assumption that is usually made is that each compartment has an exponentially distributed holding time. This makes sense because the exponential distribution is memoryless. In this case someone waiting to recover is equally likely to recover at any given time. Things like radioactive decay have taught me that exponentially distributed holding times naturally lead to rates of change that are proportional to the population size. Nevertheless, I will derive that again here because I will do something more tricky at the end of this post.

The number of individuals that recover in a given time interval is random, so the best we can do is solve for the expected number of recoveries in an interval. Whenever we model a discrete population acting randomly with a differential equation, it makes sense to use the law of large numbers. This gets us as far as:

where we have used memorylessness to simplify the conditional probability. We now need to know what the cumulative distribution function actually is. A quick trip to Wikipedia will tell you that:

We now just have to substitute this expression and Taylor expand:

We have now expressed the decay of in terms of a recovery rate . Can we do the same thing to express the decay of in terms of an infection rate ? Not quite. We don't want to equal because this does not account for the spread of infection. Susceptible individuals get the disease from people who already have it, so instead of using as our infection rate, we use thus making the equations non-linear:

The non-linearity makes the dynamical system hard to solve but it also allows it to reach an equilibrium point. The plot shows what is known as the disease-free equilibrium. This dynamical system is the classic starting point in formulating a whole bunch of epidemiological models. It can be summarized by a block diagram where each arrow going into a compartment contributes positively to its derivative and each arrow coming out contributes negatively.

One thing that is evident in this system is that we don't have any births or deaths. In other words, we assumed that the time scale for the disease was short. If we incorporate a death rate and let the birth rate be equal to it, we can explore how long lived diseases affect a population with zero net growth.

This changes the three compartments in an asymmetric fashion. The death rate applies equally to S, I and R, but the birth rate only replenishes S. This reflects the fact that individuals start off susceptible because they cannot have the disease when they are born. This bias creates the possibility for an additional equilibrium point called the endemic equilibrium. As shown in the next plot, the system can stabilize in a state where a finite fraction of the population permanently carries the disease.

The bifurcation from the disease-free steady-state to the permanent epidemic occurs when a number associated with the system, , becomes greater than 1. The number , called the basic reproduction number, has a different expression for every compartmental model but it represents the number of new infections that a single infection can be expected to cause. In almost every compartmental model, the dynamics are much different from the dynamics.

There are lots of ways in which we can make the model more complicated. We can set the birth rate to - something different from the death rate. When the total population changes, it is more appropriate to make the infection rate instead of (this is merely a rescaling of our in the previous case). We can also consider a disease where the virulence of it induces its own death rate .

Other common epidemiological models are SEIR (after becoming infected, there is a dormant exposed period during which a person is still unable to transmit the disease), SIS (the disease imparts no immunity and recovered individuals go back to being susceptible), SIRS (temporary immunity) and SIRC (instead of recovering, some people may become asymptomatic carriers that still infect others). In the literature, people have investigated the effects of vaccination, quarantining and biological warfare.

The last thing I want to do is choose a different distribution for the holding time. As we've described it so far, an individual moves between compartments by waiting for an exponentially distributed event to occur. I will keep it fairly simple here and have them wait for two exponentially distributed events. This means their waiting times have a gamma distribution with a shape parameter of 2 whose probability density and cumulative distribution are:

Since this distribution is not memoryless, we must evaluate the following conditional probability:

With this out of the way, we are ready to find the differential equation for this process using the same method as before.

It now seems clear to me how the differential equations must change if we wish to accommodate this new distribution:

I have not looked hard enough to actually find these equations in print, but it would be interesting to use them and see how things change.

### gamma distribution for infectious period

I just had a look at your blog. I am quite interested in doing parameter estimation for infectious disease models, so found what you posted very useful since I wanted to try out pymc as an alternative to winbugs with wbdiff. I just had a quick comment about your differential equations for two waiting times. I haven't seen anything like this, and I haven't had a chance to go through carefully what you have derived, but you might like to know (if you don't already) that usually people use a new system of differential equations of 4 (or more) compartment, with two (or more) infectious classes, to get a gamma distributed waiting time covering both infectious classes, i.e.

dS/dt = -betaSI_1 - beta SI_2,
dI_1 = beta SI_1 - sigma I_1
dI_2/dt = sigma I_2 - gamma I_2
dR/dt = gamma I_2

i.e they pass through the first infectious class into the second. Both infectious classes contribute to the force of infection. There is a reference to this on p94 in Matt Keeling's book on infectious disease modelling.

I t would be interesting to compare the two systems of DEs to see if they predict the same outcomes.

### Thanks

Sorry for the late reply. My guess is that both systems would be the same if it were only I_1 that contributed to the force of infection. Actually the way I wrote the equations above has a gamma distributed waiting time for S too. Not sure why I did that...