Investigating Epidemics

Code Templates and Review

The code below generates data for the measles example given in Calculus in Context.

Clear[t];
Clear[tinitial];
Clear[tfinal];
Clear[numberofsteps];
Clear[S];
Clear[i];
Clear[R];
Clear[deltat];
Clear[datapoints];
datapoints = {};
S =45400;
i = 2100;
R = 2500;
tinitial=0;
tfinal = 5;
t = tinitial;
numberofsteps = 50;
deltat = (tfinal- tinitial)/numberofsteps;
For[k=1,k≤numberofsteps,
Sprime = -.00001*S*i; 
iprime =.00001*S*i - i/14; 
Rprime = i/14; 
deltaS = Sprime*deltat; 
deltai = iprime*deltat; 
deltaR = Rprime*deltat; 
t=t+deltat; 
S = S+deltaS; 
i = i + deltai; 
R = R+deltaR;
datapoints =Append[datapoints, {t,S,i,R}]; k++]

Run the code above (there will be no output).  See what the values of  t, S, i, R are by executing the following command:

Print[t];Print[S];Print[i];Print[ R];

Go ahead and see what happens if you change the ending time to 14 days.  Execute the code, and make a note of the new values of  t, S, i, R.  Then change the number of steps to 200 and execute the code again.  Why are the answers you get different?  Which set of answers is better (and why)?

Now let's separate out the different data for  S, i, and R, so we can plot those functions separately.

Sdata = Table[{datapoints[[i,1]],datapoints[[i,2]]},{i,1, Length[datapoints]}];
idata = Table[{datapoints[[i,1]],datapoints[[i,3]]},{i,1, Length[datapoints]}];
Rdata = Table[{datapoints[[i,1]],datapoints[[i,4]]},{i,1, Length[datapoints]}];

Now we'll look at S, i, and R graphs all at the same time, on the same axes.

ListPlot[{Sdata, idata,Rdata}]

Nice!  You can figure out which curve is S, which curve is i, and which curve is R.  How?

Experiments

Learn more about the Calculus in Context example

Probably the first thing you noticed when you looked at the graphs is that they don't tell you much.  That is, not a lot happens in the first five days.  Copy and paste some appropriate code down here (and rename variables so that you don't lose your old computations above) and get the computer to display graphs to help you answer the following questions.  (The questions are in separate cells so you can create code and write responses between them easily.)

On what day is the peak of the epidemic?  What proportion of the population is infected at that time? (Do you think that this illness qualifies as an epidemic?)

When is the epidemic over?  What criteria did you use to decide what "over" means?

On what day is the size of the infected population increasing most rapidly? When is it decreasing most rapidly? How do you know?

How many people caught the measles during the first 10 days?  (Hint: You can't answer this by looking at the idata graph.)

Quarantine!

This time we will alter the model to reflect the idea that if we ask that people with measles isolate themselves so as to limit contact with healthy people, the transmission coefficient should be lower.  Again, copy/paste code to answer these questions.

Suppose the effect of quarantine is to cut the transmission coeffient in half.  What is the effect on the epidemic?  Also, what does this mean in terms of the exposure of susceptible people to infected people?

How low does the transmission coefficient need to get in order to avoid having an epidemic?  (In order to answer this question, you will need to decide what it means to avoid an epidemic.)  Is this realistic?

Let's look at [insert campus name here].

Pretend that the measles are arriving on campus.  There are about [insert appropriate number] students and staff here.  What should S,i,R be set to initially in the code to reflect the new situation?

Using the original example (not with quarantine), run the code with your new  S,i,R and see what happens.  Describe the results. (You may wish to consult earlier questions to complete your analysis.)  Keep in mind that a semester is no more than 120 days long, and that the break between semesters will effectively end the spread of infection on campus.

In the real world---what factors indicate that a measles epidemic would be likely/unlikely to happen on campus?

What about influenza?

Well, what about influenza?

As you may know, influenza is an infectious disease that has as primary symptoms fever, achiness, malaise, sore throat, and a runny nose.  It leads to 250,000 to 500,000 deaths each year worldwide (3,000 to 50,000 deaths each year in the U.S.).  There is an annual influenza epidemic.  Let's investigate.

In order to create an S-i-R model, we need to first know what the parameters are; we need to know the transmission coefficient and the duration of the disease.

It turns out that transmission coefficient isn't measured by epidemiologists.  They measure something called R, and what we call the transmission coefficient is equal to R / (shedding duration times initial susceptible population). To be very clear, there are actually two parameters that are measured by epidemiologists---R0 and R.  R0 is an initial infectivity, and is measured for new infectious diseases.  R measures infectivity for a population in which the pathogen has already been circulating, so that there is some immunity in the population (from prior exposure or vaccination).

Every year the influenza epidemic is caused by a mix of different virus strains.  One of the more infectious strains is H3N2, and when this is prevalent an epidemic is worse than when not.  Someone who works at the CDC has estimated that for H3N2, R is around 1.4 or 1.5.  (This estimate was transmitted in a private email.) So, using these numbers will model a somewhat more severe flu epidemic than average.

The duration of shedding for influenza is 6 - 11 days with a dropoff after 3 - 5 days.  So, let us average this out to 8 days for the purpose of our model. (Source: http://www.cdc.gov/flu/professionals/acip/clinical.htm.)

If R is 1.4, then what is the transmission coefficient?
If R is 1.5, then what is the transmission coefficient?

It takes about 7 days to recover from influenza, on average.

A wealth of national data is available from http://www.cdc.gov/flu/weekly/ but you want to know what the situation is right here and right now.  Call over to Health services and ask for an estimate of how many influenza cases they have seen or diagnosed over the phone in the last week, and use this as your initial number of infecteds. Run code for an influenza epidemic on campus (use R=1.5) and produce graphs to help you answer the following questions.

On what day will the influenza infection peak on campus?  What proportion of the campus will be infected at that time? Would you consider this an epidemic?  (Are you worried?)

How much of a difference does a small change in R make? Run new influenza S-i-R code with R=1.4 and compare your new graphs to your old graphs.  How does this change the situation?

If you're feeling really ambitious, try to figure out by what proportion self-quarantining will reduce a transmission coefficient.  (What fraction of the normal number of people you have contact with over a day will you see if you stay home in bed?)  And then see how self-quarantinement affects the spread of influenza across campus.