The Travelling Disease

56
The Travelling Disease Introduction to Computer Simulations Abhi Agarwal & Philip Ottesen 1 Introduction In this simulation, we consider the stochastic evolution of a disease across an isolated system of four cities connected by roads. Note that the system repre- sents an undirected, connected graph. Each city i will contain the disease D to a differing degree, where D is assumed to be a non-lethal disease spread by con- tact. To model four unique cities with environmental variables that realistically differ such as sanitation levels and availability to medical treatment, we let the resultant infectivity a i of the disease and growth rate b i be unique. To introduce travel, we define travel rates to be the probability per unit time of an individ- ual travelling from city i to j . We examine the behaviour of the system as D evolves, whilst noting the growth of the disease in individual cities, through the use of pie charts. The fraction of susceptible, infected, and recovered citizens of each city with respect to the total population is plotted, with the corresponding proportion for the global population charted to present the state of the isolated system at any time-step. First, we consider a stochastic model with static travel rates. These rates are systematically varied to consider disparities in the evolution of D between cities with high immigrant rates versus low immigrant rates. To verify com, we show that populations will tend to migrate towards cities with high incoming and low outgoing travel rates. We also consider configurations with an epidemicity e given by the number of cities where a i >b i holds. a i <b i is then the case for n-e cities, where n is the number of cities. An edge-case where the reproduction number R 0 of all cities is 1. Here, travel rates are varied to study what range of approximate range of rates maximize the spread of D, and whether an upper- bound to the maximum number of cases over the duration of D exists. The model is extended to incorporate dynamic immigration rates, with probability per unit time proportional to Ii Ni . The resultant traffic flows will exhibit a bias towards cities with less severe outbreaks, modelling the movement of a population in an epidemic. A citizen may not have access to the reproduction number of the disease, but media outlets may provide an estimate of the above proportion, resulting in biased traffic flows. Lastly, we combine dynamic rates with an ability to quarantine incoming and outgoing travel. 1

Transcript of The Travelling Disease

Page 1: The Travelling Disease

The Travelling Disease

Introduction to Computer Simulations

Abhi Agarwal & Philip Ottesen

1 Introduction

In this simulation, we consider the stochastic evolution of a disease across anisolated system of four cities connected by roads. Note that the system repre-sents an undirected, connected graph. Each city i will contain the disease D toa differing degree, where D is assumed to be a non-lethal disease spread by con-tact. To model four unique cities with environmental variables that realisticallydiffer such as sanitation levels and availability to medical treatment, we let theresultant infectivity ai of the disease and growth rate bi be unique. To introducetravel, we define travel rates to be the probability per unit time of an individ-ual travelling from city i to j. We examine the behaviour of the system as Devolves, whilst noting the growth of the disease in individual cities, through theuse of pie charts. The fraction of susceptible, infected, and recovered citizens ofeach city with respect to the total population is plotted, with the correspondingproportion for the global population charted to present the state of the isolatedsystem at any time-step.

First, we consider a stochastic model with static travel rates. These rates aresystematically varied to consider disparities in the evolution of D between citieswith high immigrant rates versus low immigrant rates. To verify com, we showthat populations will tend to migrate towards cities with high incoming andlow outgoing travel rates. We also consider configurations with an epidemicitye given by the number of cities where ai > bi holds. ai < bi is then the case forn−e cities, where n is the number of cities. An edge-case where the reproductionnumber R0 of all cities is 1. Here, travel rates are varied to study what range ofapproximate range of rates maximize the spread of D, and whether an upper-bound to the maximum number of cases over the duration of D exists. Themodel is extended to incorporate dynamic immigration rates, with probabilityper unit time proportional to Ii

Ni. The resultant traffic flows will exhibit a

bias towards cities with less severe outbreaks, modelling the movement of apopulation in an epidemic. A citizen may not have access to the reproductionnumber of the disease, but media outlets may provide an estimate of the aboveproportion, resulting in biased traffic flows. Lastly, we combine dynamic rateswith an ability to quarantine incoming and outgoing travel.

1

Page 2: The Travelling Disease

2 Theory

We present our modifications to the Kermack & McKendrick comparmental SIRmodel. Let Fα,i,j be the matrix of probabilities per unit time for an individualin α to travel from i to j, where α is a class from the SIR model. Note thatdiagonal entries in F are zero, since the probability of remaining in a city at agiven time-step is implicitly defined as the complement of leaving the city. Ateach time-step, we aggregate any traffic leaving i to j and entering i from j.First, we show the deterministic SIR model with traffic rates.

dSidt

= −a IiNiSi +

4∑j=1,j 6=i

SjFS,j,i − Si4∑

j=1,j 6=i

FS,i,j (1)

dIidt

= aIiNiSi − bIi +

4∑j=1,j 6=i

IjFI,j,i − Ii4∑

j=1,j 6=i

FI,i,j (2)

dRidt

= bIi +

4∑j=1,j 6=i

RjFR,j,i −Ri4∑

j=1,j 6=i

FR,i,j (3)

Note that the total population size for the isolated system is Nt, where∑4i=1Ni = Nt. We discretize time with epochs = 0, 1, 2, .... The unit of the

epoch in this model is the day. Let P (I) = aiIiNi

dt and P (R) = bidt. Let pdenote a uniformally distributed random variable. Similar to the Tuckwell &Williams model1, we define the following stochastic processes.

Ii(p, t) =

{1 : p < P (I)0 : p ≥ P (I)

Ii(p, t) gives the state of individual i at time t. If Ii(p, t) = 1, that individualis infected. Hence, the total number of infected individuals is given by I(i, t) =∑Ni

k=1 Ii(p, t) for t ≥ 0. Similarly,

Ri(p, t) =

{1 : p < P (R)0 : p ≥ P (R)

R(i, t) =∑Ni

k=1Ri(p, t) gives the number of newly recovered individuals at

epoch t for t ≥ 0.

Aggregation of incoming and outgoing travel is probabilistic. To computethe flow of individuals in an (i, j) pair at epoch t, we use random processes sim-ilar to those above. Unless stated, we assume that infected individuals travel atdifferent rates from susceptible or recovered individuals, which models a symp-tom of D where the disease has some influence on the ability to travel. Thiswill also simplify an interesting case where we quarantine cities, decreasing theprobabilities per unit time for infectious migration of an individual. Hence, weuse two random processes, FSR,i,j and F I,i,j , to aid in aggregating migrationbetween cities. In general,

1http://personal-homepages.mis.mpg.de/tuckwell/tuckwell2007mathbiosciwilliams.pdf

2

Page 3: The Travelling Disease

F i,j(p, t, β) =

{1 : p < dtFβ,i,j0 : p ≥ dtFβ,i,j

F (β, i, j, t) =∑βi

k=1 Fi,j(p, t, β) gives the number of individuals from the

class β who have left city i to city j. Hence, for each time-step of the simu-lation, β(i, t) = β(i, t) − F (β, i, j, t) +

∑4j=1,j 6=i F (β, j, i, t). To constrain the

amount of travelling individuals at any given time-step, we restrict the prob-ability Fα,i,jdt << 1. We use the following heuristic: at each time-step t, weaggregate incoming and outgoing traffic for the ordered tuple (i, j), where i ≤ j.Hence, each city is given its round of traffic aggregation at each time-step, andwe do not consider (j, i) since the tuple (i, j) have been processed at an earlieriteration.

The stochastic SIR model is activated when fluctuations in populations dueto travel become somewhat stable. Empirically, this occurred after at most t

8simulated days in our set of trials, where t is the number of days to simulate.This value can be computed analytically, but this solution is not consideredhere. This allows populations to settle before the SIR model in each city isintroduced, and allows for a probable extension of the model to incorporatedynamic travel rates.

To implement dynamic travel rates, consider a city i. If an individual ini had access to information on the severity of the disease (in this model, theparameter Ii

Ni), it is realistic that each individual will attempt to make an op-

timal decision about their travel destination. For example, visiting cities withhigh concentrations of infected people may increase the likelihood of becominginfected. In our extended model using dynamic travel rates, we assume thatan individual will bias their travel based on the statement Ii > Si + Ri for agiven day. If this statement is true, travel from i to j becomes Fβ,i,j = Ii

Ni.

Similarly, Fβ,j,i = 1 − Fβ,i,j in this case, since an individual in city j will biashis decision to leave j for i. The two probabilities become dependent in thisdefinition, whereas previously they were not. On the other hand, if Ii < Si+Ri,travel rates resume their static values for that day.

Symbol Definitione Number of cities with a > bk Multiplier for ratesd Duration of disease in daysn Number of cities with maximum incoming travel ratesτ Day on which infection peakedFα,i,j Travel rates in class α from i to jNt Total number of individuals in the network.

Table 1: Table of new variables.

3

Page 4: The Travelling Disease

3 Results

Unless stated, initial parameters can be found in their corresponding appendices,with comments.

3.1 Static Travel Rates

In this experiment, we study the behaviour of the system as a function of immi-gration rates, with all other parameters constant. We plot the resultant changesin susceptible, infected, and recovered individuals per city over time, and discussdiffering trends.

To evaluate the computational accuracy of stochastic travel in this model,we will first observe the distribution of the citizenry over time with n citiesX = X1, . . . , Xn whose travel rates Fα,i,Xk

are a maximum and Fα,Xk,j are aminimum. Let 1 ≤ n ≤ 4. Assuming that traffic aggregation does not skip ormiscount travel for some city, we should be able to predict the distribution ofthe citizenry across cities. That is, for n = 1, one city should have a notablemaximum population. We compute the peak of infection on a given day, andrecord the day-number as τ .

The values used for Fα,i,Xkand Fα,Xk,j are shown below for n = 1. Since

the first four cases consider computational accuracy, we make no distinctionbetween travel rates for susceptible, infected, and recovered individuals. Wealso allow travel rates to be equal for the cities in X. The distinction madebetween FSR,i,j and FI,i,j in Theory will be studied in later trials.

Figure 1: Matrix showing travel rates between cities

4

Page 5: The Travelling Disease

3.1.1 n = 1

Figure 2: Pie chart for the simulation showing the proportion of infected/re-covered population at a particular timestep

Figure 3: Graph showing the variation of the population, recovery, infected,and susceptible population

To produce the above results, we let FSR=I,1,j = 0.05 and FSR=I,j,1 = 0.1.Note that 1 refers here to the city number, not n. Hence, it is most probablethat city 1 will aggregate more incoming traffic than other cities. Indeed, theupper-left pie chart representing city 1 has accumulated a higher population

5

Page 6: The Travelling Disease

than other cities. Also, from figure 2, the populations of the three smaller citiesare approximately equal. However, as expected, the fluctuations in populationsare not equal, as shown by the population-plots for cities 2 and 3. Although theprobabilities of an individual travelling to neighboring cities are equal in thiscase, the stochastic nature of traffic aggregation enforces that these migrationpatterns be distinct.

Note that in these cases, ai > bi,∀i = 1, . . . , 4, which indicates that D is anepidemic. The impact of a and b on the system is studied in a later section.Here, we record that the time taken for each city to reach a peak in infectedpopulation. For city 1, using the calculation shown below, we find a maximumafter 126 days of infection. However, as stated in Theory, the infection is notintroduced until after t

8 ≈ 45 days. Hence, τ1 = 81. Cities 2, 3, 4 gives peaksat 84, 89, 77 days respectively. This gives τ̄ = 82.75, with a standard deviationσ = 5.06.

The method used to compute maxima is given below.

Figure 4: Method used to compute maxima

6

Page 7: The Travelling Disease

3.1.2 n = 2

Figure 5: Pie chart for the simulation showing the proportion of infected/re-covered population at a particular timestep

Figure 6: Graph showing the variation of the population, recovery, infected,and susceptible population

Consistent the results for our trial with n = 1, we observe two cities with ahigh population and two with a small population. We find that τ1 = 56, τ2 =59, τ3 = 54, τ4 = 63, yielding τ̄ = 58 with σ = 3.92. For n = 1, 2, we see thatthe peak intensity of the infection is reached in approximately the same week.

7

Page 8: The Travelling Disease

3.1.3 n = 3

Figure 7: Pie chart for the simulation showing the proportion of infected/re-covered population at a particular timestep

Figure 8: Graph showing the variation of the population, recovery, infected,and susceptible population

From figure 7, it is apparent that the population of the system is concentratedin cities 1, . . . , 3. The populations of these cities tends to be more volatile thanthe minor city. Note the relative amplitude of oscillations in cities 1, 2, 3 com-pared to city 4. Although it is more likely for an individual in 4 to travel to

8

Page 9: The Travelling Disease

1, 2, 3, the major cities have almost twice as many citizens as 1. Recall that thecase studied here allows travel from 4 to its neighbors with a probability of 0.1,with a probability of travel to 4 of 0.05 for all other cities. The difference inprobabilities is not sufficient to prevent travel to 1 entirely. We observe thatalthough Fα,j,4 = 0.05, we have that Nj >> N4 such that the expected numberof people Fα,j,4Nj travelling in a day is greater than Fα,4,jNi. Hence, we expectfluctuations in populations of the major cities to be more prominent than minorcities. We saw this for n = 1, 2 in figures 3 and 6. For n = 4, the previousassertion is no longer useful since Nj tends towards Ni as the population isno longer concentrated and we have equal travel rates. However, this may nothold for larger travel rates. As travel rates approach 0, we conjecture that thesystem tends towards deterministic behaviour. This will be investigated in thenext section.

For n = 3, we have τ1 = 64, τ2 = 57, τ3 = 62, τ4 = 55 giving τ̄ = 59.5 withσ = 4.20.

9

Page 10: The Travelling Disease

3.1.4 n = 4

Figure 9: Pie chart for the simulation showing the proportion of infected/re-covered population at a particular timestep

Figure 10: Graph showing the variation of the population, recovery, infected,and susceptible population

Indeed, following our arguments in the previous case, the populations across thenetwork do not become concentrated at the conclusion of the program. Fromfigure 9, the respective pi-charts are similar in size when the maximum travelrate between any two cities is 0.1.

10

Page 11: The Travelling Disease

We have τ1 = 71, τ2 = 68, τ3 = 70, τ4 = 68 giving τ̄ = 69.25 with σ = 1.50.Our observation in the previous sections that the peak intensity of D reachedwithin a week for each city is consistent for n = 1, 2, 3, 4 with the given travelrates.

11

Page 12: The Travelling Disease

In Theory, we made a distinction between FSR,i,j and FI,i,j . For the nextthree trials, we evaluate the result of this distinction. We now observe howinequalities between FSR,i,j and FI,i,j affect the spread of D across the network.We can here note that we’re starting with an epidemic in each city, so thefollowing three trials will take place in a network with n = 4.

3.1.5 FSR,i,j = FI,i,j

Figure 11: Graph showing the variation of the population, recovery, infected,and susceptible population

In this case for all the cities we have set all the traveling rates for the susceptible,infected, and recovered population to be the same. The statement basicallymeans that there was an equal probability per unit time for a diseased personto come in to a city as a recovered or susceptible person, so we are assumingthat a healthy and a sick person are equally as likely to travel. We also shouldnote that in this example, each city does not have the same travel rates as oneanother. Each city is not taking in the same amount of individuals that areleaving.

From the figures above we can see that for each city the structure of eachsub-graph is very similar, and that each city experiences levels of infection, andrecovery in a very similar way. There is a rise in the number of people infectedas the number of susceptible individuals fall for each city, and then as infectionfalls there is a rise in recovery, which is clearly what we should be seeing in ourmodel.

We can see that there is established travel as when infection rises the pop-ulation of city two increases, and this is because the travel rate of city two ishigher than the rest, and so it draws in more individuals as infection peaks. Ascity two draws more infected people, this increases the risk of being infected incity two as our infection spread is determined by the ratio of infected peopleover the city’s population.

12

Page 13: The Travelling Disease

We will reference this model later as we develop and look at the other casesof travel rates for S, I, and R. We should note that it takes 376 days for thisparticular model to eradicate the disease

3.1.6 FSR,i,j > FI,i,j

Figure 12: Graph showing the variation of the population, recovery, infected,and susceptible population

In this case we explored when for all the cities, all the traveling rates were thehigher for the susceptible, and recovered population than the Infected popula-tion. This is what is depicted in the real world, but we’re only considering staticrates for travel, and so this would simulate as if no travel changed even afterthe diseases is critical.

This particular model takes 388 days to eradicate, which is interesting to lookat when compared to FSR,i,j = FI,i,j . It’s interesting to see that when there aremore susceptible individuals traveling there is still a higher recovery date whencompared as it can be a little counter intuitive at first. The data analysis andgraph show that because there were a higher number of susceptible individualstraveling at the beginning they experienced different levels of infection, anddifferent stages of infection in a city. As there are individuals traveling fromlow infected cities to high infected cities they have a higher chance of gettingthe disease, and in the beginning when the number of susceptible individualsis higher and they are traveling they are very likely to catch the disease. Thispeaks when the ratio of susceptible individuals to infected individuals reduces toone, and this is when the peak occurs, and as the number of susceptible peopletraveling is falling.

13

Page 14: The Travelling Disease

3.1.7 FSR,i,j < FI,i,j

Figure 13: Graph showing the variation of the population, recovery, infected,and susceptible population

In this case we explored when for all the cities, all the traveling rates were lowerfor the Susceptible, and Recovered population than the Infected population.This implies that sick or unhealthy individuals are more likely to travel thanrecovered or healthy individuals, which is unlikely to happen but still importantto study.

In this example we see the massive spike and falls in city population asinfection peaks, and this is because individuals are traveling more as infectionrises, and this is because as infection rises there are more infected people, and sothis increases travel in general, which increases spread. There is a chain whereas more people travel to highly infected cities the spread multiplies, and we cansee that in the huge spikes that happen in City 1 and City 2 as we reach peakinfection.

This particular disease takes 424 days to eradicate, which is more than thoseproposed above. This should be the case as individuals are traveling throughcities with different 1

b or recovery rates, and they experience recovery in differentways. This is something we can see in the real world as well, if individuals weremore likely to travel while they were sick then the recovery would take longer.This case is a little less unlikely to happen in the real world as governmentsusually intervene and wouldn’t allow this to happen, and also the fact thatweakness increases in sickness so not everyone is physically able to travel.

3.1.8 Observations on FSR,i,jandFI,i,j

It is very interesting to see here that there is a somewhat trend between thetravel rates, and the duration of the disease. There is an increased duration ofthe disease if we let more sick individuals travel, which is intuitive to understand,

14

Page 15: The Travelling Disease

but even with static travel rates solidifies our understanding of this particularmodel. We will be looking more at this comparison when we study DynamicRates and develop our understanding of Static Rates further.

3.2 Reproduction number R0,i

In this section, we study the spread of D under varying reproduction numbersR0,i. First, we examine the case where e cities have R0,i > 1. We will onlyexamine cases where the network does not initially experience an epidemic.Hence, a case with e = 4 is ignored. Interesting cases are e = 1, . . . , 3.

To quantify the severity of D, we plot ItNt

over time.Since our model limits contacts to social encounters, i.e. no airborne spread,

we maintain 5 ≤ R0,i ≤ 7 for each city with a > b, similar to smallpox2.Note that the simulated time is 2 years, with dt = 1 day. The outbreak of

D therefore occurs after 7302 ≈ 91 days of idle travel. The default travel rates

from appendix A are used for the following trials.

3.2.1 e = 1

Figure 14: Pie chart for the simulation showing the proportion of infected/re-covered population at a particular timestep

2http://www.bt.cdc.gov/agent/smallpox/training/overview/pdf/eradicationhistory.pdf

15

Page 16: The Travelling Disease

Figure 15: Graph showing the variation of the population, recovery, infected,and susceptible population

With the values of ai and bi shown in figure 17, D only reached approx 58

of the total population. Figure 18 shows that the infection had a durationof approx. d = 500 − 91 = 409 days of infection. Interestingly, given thatmax{bi}∀i = 1, . . . , 4 = 0.07, the maximum time taken for an individual torecover from D is 1

0.07 = 7 days, the disease survived 409 days in the network.However, e = 1 was not sufficient to infect all members of the population. Alsonote that τ = 260.

Figure 16: Graph showing the variation peak of the infection

16

Page 17: The Travelling Disease

3.2.2 e = 2

Figure 17: Pie chart for the simulation showing the proportion of infected/re-covered population at a particular timestep

Figure 18: Graph showing the variation of the population, recovery, infected,and susceptible population

Compared to figure 17, we see an immediate change in the behaviour of D. Itspread through the network significantly faster than e = 1, as expected. Wehave two cities with conditions for an epidemic contributing to τ . We findthat τ ≈ 52, with a peak of 1400 infected or a ratio to the total population of

17

Page 18: The Travelling Disease

1400Nt

= 14003100 = 0.45. Although the infection peaked earlier than e = 1, and with a

larger maximum, the number of infected individuals across the network reached0 after d = 300 − 91 = 209 days of infection. Hence, the disease lasted half aslong as e = 1. There appears to be an inverse relationship between e and theduration d and day of maximum infected individuals τ , while an earlier τ impliesa shorter duration d. The expected number of individuals moving from I to Rfor any given city for each time-step is proportional to the number of infectedpeople in that city, since R(i, t) =

∑Ni

k=1Ri(p, t). Therefore, if D saturates the

network with infected people early on, R(i, t) will be large early on, decreasingwith t. For e = 1, we observed a small pocket of the network infected overthe period of the simulation, and hence, R(i, t) is sufficiently small to allow asmall proportion of infected people to move through the network. Hence, thissmall infected group faces less resistance when moving through the networkcompared to the growing concentration seen in e = 2. This corresponds to theobservation that every individual can only be infected and can only recover once,such that the critical R(i, t) marks a significant number of infected individualsas recovered for each time-step. An interesting complication of this model wouldbe to neglect immunity from D such that there exists a reverse process from Rto I.

Figure 19: Graph showing the variation peak of the infection

18

Page 19: The Travelling Disease

3.2.3 e = 3

Figure 20: Pie chart for the simulation showing the proportion of infected/re-covered population at a particular timestep

Figure 21: Graph showing the variation of the population, recovery, infected,and susceptible population

Confirming our results from e = 2, we find a smaller τ = 130 − 91 = 39 witha higher peak of 1635 infected individuals. The duration d = 262 − 91 = 171days, and again we see that as e increases, the duration d and τ are left-shifted.

19

Page 20: The Travelling Disease

Figure 22: Graph showing the variation peak of the infection

3.3 Ri,0 = 1

In a deterministic or stochastic SIR model without travel, with a reproductionnumber R0,i = 1 ∀i = 1, . . . , 4, the disease will not spread throughout a givencity. This can be shown using our model by setting all travel rates to 0. Froma previous study on the number of cities with R0,i > 1, we showed that pocketsof infected individuals moving through the network increase the duration of D.An infected individual will recover slower in cities with smaller b. The travelof infected individuals through the network is directly related to the durationof the disease, which suggests that there might be optimal travel rates that in-crease the total number of individuals who have contracted D.

However, once travel is introduced, it is possible to propagate the small frac-tion of infected people in each city such that D infects a significant proportionof the total population.We show this by considering the proportion It

Nt, where

It gives the total number of infected people.To vary travel rates systematically, we introduce a multiplier 0.003k, where

k is some positive number.The multiplier is used to increment all travel rates,with varying k. We posit that for large k, i.e. a busy network since travel ratesare high, we should observe a well-mixed population such that the dominantspread of D is through the SIR model. We can see this by comparing hightravel rates with the 1-city case. We have chosen rates such that a low k willnot affect the expected outcome of the disease, i.e. very short duration whenRi,0 = 1. Hence, there appears to be some optimal k such that the number ofinfected people at any given time reaches a maximum.

Below, we see the travel rates used for this experiment. The number ofindividuals in each city has not changed, but dt = 0.5 days. We let k ≤ 50 suchthat the restriction Fα,i,j ∗ dt < 1 holds for this set of trials. Unlike k = 50,we give an extended analysis for the case k = 11 since Fα,i,j ∗ dt << 1 and

20

Page 21: The Travelling Disease

max{Fα,i,j ∗ dt} = Z. However, since we attempt to show an upper-bound onthe range of optimal travel rates, we consider the extreme k = 100, althoughmax{Fα,i,j ∗ dt} = 0.27.

(a) Initial travel rates.

(b) Incremented travel rates for k = 100.Note that the probability for travel isFα,i,jdt.

Figure 23

3.3.1 k = 5

For low k, we posited that this particular system will not exhibit a significantspread of D. Recall that each travel rate from figure 26 has been incrementedby 0.003(5) = 0.015.

21

Page 22: The Travelling Disease

Figure 24: k = 5.

Indeed, the proportion of recovered individuals is negligible, and equivalentto a case with no travel between the cities. Line 81 of appendix B was used toshow the number of newly infected individuals. For k = 5, we found a negligible8 new cases of D over the period of two years.

3.3.2 k = 50

We found that the disease spanned a comparatively large area of the globalpopulation chart for 50 ≤ k in contrast to k = 5. In particular, k = 50 gaveIt ≥ Nt

4 , where It is the global number of infected individuals.

22

Page 23: The Travelling Disease

Figure 25: k = 50.

From figure 28, the spread of D for k = 50 clearly dominates over k = 5.The trial can be repeated using code from appendix B, and one can test whetherthe maximum at k = 50 is a statistically significant finding. However, since k isan arbitrary measure of the optimal set of travel rates, we will focus on testingour hypothesis rather than computing an exact value for the optimal k.

Figure 26: Plot of population distribution over time. B = S,R = R,G = I.

23

Page 24: The Travelling Disease

Figure 27: Number of globally infected individuals on any half-day.

From the figure above, we see that the susceptible and recovered lines areclose to intersecting. dS

dt and dRdt , excluding stochastic travel, converge to 0 near

the end of the simulation. Since the x-axis is in half-days, this correspondsto roughly 1500

2 = 750 days. Hence, the number of individuals who have beeninfected and eventually recovered is nearly half the global population. Due tostochastic noise, this has not always been the case. In our runs, we have foundthat k ≥ 50 tends to produce 1

4 recovered individuals. Note the small values ofinfectivity and growth rate from figure 28, and recall that a similar observationto the following was made earlier. Although the recovery period for an individualis at most 1 week (city 1), we have a duration of approx. d ≈ 750 days. Werefrain from taking the difference with a 91-day offset, since the infection wasnot entirely wiped out, 750 days is a reasonable upper-bound based on previousexperiments where the disease lingers for a few weeks. Where we initially hada short-lived disease for k = 5, we now have a disease which is endemic in thepopulation over the course of at least 2 years. By computing the total recoveredindividuals after the simulation, and incorporating any outlying individuals stillinfected, we obtain a total number of infected individuals of 999 or 32% of theglobal population for figure 29. For a more precise value, one might increasethe bound on simulated time, to ensure that the infection dies out by the endof the simulation. From figure 30, we find that τ = 918d2 ≈ 459 day with a peakof infection of 65 individuals. However, since the SIR model was not activated

24

Page 25: The Travelling Disease

until 91 days into the simulation, we have τ = 459− 91 = 368.

3.3.3 k = 100

Figure 28: k = 100.

Figure 29: Plot of population distribution over time. B = S,R = R,G = I.

Here, we increase all travel rates by a factor of 100(0.003) = 0.3 to consideran extreme case. Although a large increment, note that 0.3dt = 0.15, so our

25

Page 26: The Travelling Disease

maximum travel rate Fα,i,j from our initial travel rates in figure 31 is FSR,1,3 =0.22 + 0.3 = 0.52, with FSR,1,3 ∗ dt = 0.27 < 1.

We see an immediate similarity between the above figures and the corre-sponding figures for k = 50. The overall newly infected individuals is reached780 or 25% of the global population. A comparison of figures 32 and 29 willshow that regardless of the large differences in travel rates from k = 50 tok = 100, while dI

dt and dRdt reach 0 at different times, they tend to reach a

non-epidemic steady state (since the lines never intersect). This suggests thatour intuition of an upper-bound to an optimal k is consistent with results. Aplausible reason for this is that as travel increases, the populations become well-mixed, and hence the behaviour of D will eventually converge to that of a singlecity SIR simulation with R0,i = 1 with negligible new infections. Furthermore,note from figure 33 that the number of infected individuals in each city peaksearlier than figure 30. As we deduced in the subsection on epidemicity e = 2,an earlier τ implies a shorter duration. Indeed, the duration of D is approx.d = 1387

2 − 91 = 603 days, shorter than d50 = 750 days. The peak of infectionoccurred on day τ = 779

2 − 91 = 390− 91 = 299, with a maximum of 55 infectedcitizens.

Figure 30: Number of globally infected individuals on any half-day.

26

Page 27: The Travelling Disease

3.4 R4,0 > 1, e = 1

In this experiment, we build on ideas developed in the previous section wherewe found optimal k producing a significant outbreak of D. Here, we consider theminimum travel rates required to infect the majority of the population for e = 1.We will fix e = 1 with a4 > b4, and incrementally vary travel rates. Again, weconstrain our travel rates such that the product with dt is small compared to 1.

We increment travel rates using the previous multiplier, 0.003k, where k isa relative measure of the increase in rates across all cities. For the initial travelrates, refer to lines 31 and 32 in appendix B.

3.4.1 k = 1

To confirm that the above set of initial rates results are insufficient to cause anepidemic across the network, we refer to figure 34.

Figure 31: Pie chart for the simulation showing the proportion of infected/re-covered population at a particular timestep

Indeed, as observed in the first e = 1 trial, we find that the system does notreach an epidemic state. Now we will investigate whether such a state is at allpossible by varying travel rates alone.

3.5 k = 5, 80

We found that k ≤ 5 tended to produce cases numbering between 12 to 5

8 of theglobal population.

27

Page 28: The Travelling Disease

(a) k = 5. (b) k = 80.

Figure 32

In the trial shown above for k = 5, an increment of 0.003(5) = 0.015 inthe travel rates caused approx. 1

2 infections in the network. We show thatthis relationship is not linear. i.e. an increment of 0.003(10) = 0.03 will notcause the entire population to become infected. In fact, the number of cases fork = 80 or an increase in rates by 0.24 differs from k = 5 by approx. 1

8 . Sincethe highest travel rate in this set of parameters is FSR,4,1 = 0.076, we have(FSR,4,1 + 0.24)dt = 0.316(0.5) = 0.158 << 1, so k = 80 is not an unreasonabletest-case. We conjecture that it is not sufficient, for a general set of parameters,to cause D to behave as an epidemic by increasing travel rates across the networkalone. However, for k = 5 and k = 80, we see that the number of susceptibleand recovered individuals converge since more than half the population becomesinfected.

(a) k = 5. (b) k = 80.

Figure 33

3.5.1 Dynamic Travel Rates

Dynamic travel rates are similar to static travel rates, but with a twist where wechange the travel rates as the model evolves. When the simulation begins it runsexactly the same way as it did for the static rates until we reach a point where thenumber of infected people is greater than the number of susceptible/recoveredpeople, and this is where the dynamic rates come in. We change the travel ratesbetween cities to mirror what is going on within those cities, and the effect thatoccurs when panic kicks in.

Lets take an example of the panic. As the disease spreads and there is a highproportion of infected individuals to the total population of the city panic occursas newspapers, televisions report that there is an outbreak, and in the real worldthis would definitely change travel patterns and so the dynamic travel rates will

28

Page 29: The Travelling Disease

try and simulate this. The travel rates for both the infected population and thesusceptible/recovered population are biased by Numberofinfectedpeopleinthecity

Totalcitypopulation ,and it updates the travel rates for all cities coming into city I, and leaving cityI.

3.5.2 FSR,i,j = FI,i,j

Figure 34: Graph showing the variation of the population, recovery, infected,and susceptible population

This is an interesting model to look at when comparing to dynamic rates.Firstly, the duration the duration for this particular disease is 808 days. This isimportant as we can clearly see that the introduction of dynamic rates as sky-rocketed the duration of the disease lasting. This is because we bias our valuestowards the number of individuals infected, and also because of the panic thatis created. Because of the panic the values increase as susceptible people leavethe city to miss the disease, and infected people leave the city to seek medicalattention or for work. In this particular example we know that sick people areas likely to travel as susceptible/recovered people, and so we can see the effectsof this in the graph.

29

Page 30: The Travelling Disease

3.5.3 FSR,i,j < FI,i,j

Figure 35: Graph showing the variation of the population, recovery, infected,and susceptible population

In this example we consider a scenario where we are changing the travel ratesbut leaning more towards more infected people traveling than more suscepti-ble/recovered people.

The duration for this particular model is 907 days. This follows our trendof the increasing values, and this should be the highest peak in our examplesas we’re considering a model where we are biasing values towards the level ofinfection, which in turn is increasing the number of infected individuals travelingeven more. This increase in travel for infected people leads to more infectedpeople traveling as they go through a variety of recovery rates, and in this caseare impacted because of the bias even further.

30

Page 31: The Travelling Disease

3.5.4 FSR,i,j > FI,i,j

Figure 36: Graph showing the variation of the population, recovery, infected,and susceptible population

This particular model is the closest I think we possibly could get to the realworld out of our examples, and a very particularly important one to study.This is close to the real world because we’re able to simulate both dynamictraveling rates and the spread of disease with only a couple of limitations. Thedynamic travel rates is important as it simulates an outbreak of panic, which issimilar to what happens as an epidemic spreads in the real world.

We should note that this particular simulation takes approximately 631 daysto eradicate the disease. This is important as this is fairly lower than the twodynamic models we have seen able, and fairly accurate. We have assumed thesame difference between the susceptible/recovered traveling rates and infectedtravel rates as we did with FSR,i,j < FI,i,j . This is important because it es-tablishes a trend where we are able to confirm that panic does in fact create ahigher duration, and that in this example a lower travel rate for the infectedpopulation does reduce the duration, which was our hypothesis on the topic.This occurs because as we bias our results towards infection, we know that therates will adjust so the number of susceptible/recovered individuals would bemore likely to move towards cities which have the lowest infection, while theinfected population would be less likely to travel when compared to them. Ini-tially this would not matter as the model only starts after I > SR for travelrates, but this would really take effect after the infection has peaked. As thismodel tries to adjust the travel rates for SR to be greater than the travel ratesfor I more individuals would have a probability of not traveling, and thereforerecovering.

We also managed to simulate the effect when the individuals who are travel-ing travel towards cities with lower 1

b values rather than traveling to cities withhigher 1

b values, which would help them recover faster. This is what actually

31

Page 32: The Travelling Disease

would happen in the real world as the travel rates would in fact change as gov-ernments, individuals, and organization educate the people about the disease.Some of the susceptible population would also move out of a highly infected cityto miss the disease.

3.6 Quarantine

Quarantine is a special case where we used Dynamic Rates to simulate whatgovernments would normally do when infection is really high, and they want tocut off travel rates. The process is basically to simulate an event that wouldclose off travel a particular city and the rest (both incoming and outgoing).

Figure 37: Graph showing the variation of the population, recovery, infected,and susceptible population

From the Figure above we are able to see the quarantine in action. If welook at City 4 we are able to see that after a period of time the travel stops andthe line flattens. This is because we have set quarantine to occur when the levelof infection in a city is greater than both recovery and the number of susceptibleindividuals. When this occurs the government would shut off all travel, and thecity will recover on its own. This exactly what we see - at a point the city cutsoff all its travel, and the line flattens. This is also a point where the recoverygrows on its own without spikes, and infection reduces without any spikes.

32

Page 33: The Travelling Disease

This is a fair example of when the government would introduce total quar-antine as individuals wouldn’t be allowed to leave. The duration here is 752for the total the whole global population, but about 710 days for City 4. Sobecause there isn’t an exchange of any more susceptible individuals or infectedindividuals the city is able to recover a little faster.

4 Conclusion

In conclusion, as we were attempting to model the different scenarios we founda few fundamental concepts that were apparent in all of them.

Duration of disease is inversely related to epidemicity e. We found that thereexists a relationship between how many cities have the potential for an epidemicat the start and the duration of the epidemic. As we increase e in a model theduration of the epidemic increases by some constant factor. Furthermore, anearlier τ implied a shorter duration. These relationships were present in boththe model for static rates, and for dynamic rates.

Travel rates and reproduction number determines behavior of disease. Wefound that altering the values for the travel rates and the reproduction numberchanged the duration of the disease, and the behavior of the disease. As we notedin the dynamic rates model changing the travel rates during the simulationchanged the duration of the disease, and the fact that the ratio between thesusceptible/recovered travel rates and the infected travel rates was also a bigfactor in determining the behavior of how the disease evolved. In addition, wealso had a different reproduction number in different cities for each simulation,which allowed us notice that infection spreads differently if people recover/catcha disease in a different city, and that travel not only spreads the disease but alsospeeds up/slows down recovery based on the values for a and b within a city.This is important as we realize that recovery in your own city doesn’t solvethe issue if individuals traveling into your city have a low recovery and highinfection.

When R0 = 1, we found that increased travel rates could give rise to a sig-nificant spread of D in the global population. The result was endemic behavior,where the duration of the disease was significantly larger than the recovery pe-riod 1

b . However, we saw an upper-bound to constant used to increase travelrates. An increase in rates by a factor of 0.30 yielded an outbreak in 25% ofthe total population, while an increase of 0.15 produced cases in 32% of thetotal population. By plotting the change in susceptible, infected, and recoveredindividuals over time, we showed that the number of susceptible and recoveredindividuals tends to converge but never intersects. The upper-bound was inter-preted as an inflection point wherein the global population becomes well-mixedsuch that the system behaves like a dominating SIR model acting on a sys-tem with no travel. We argued that since the minimum travel rates requiredto optimize the number of cases of D across the network showed a behaviourconsistent with the previous threshold study, increasing travel rates are not suf-ficient to cause an epidemic in general. However, whereas the epidemiology ofa disease in the Kermack & McKendrick SIR model can be specified using R0,the epidemiology of the travelling disease cannot be classified by R0 alone.

33

Page 34: The Travelling Disease

4.1 Future Work

4.2 Apply to SEIR, SIS, birth and deaths models

In the future we’re able to introduce some new variables/alternations to themodels above to make improvements or to study different variations. Firstly,we’re able to study the SEIS model (E is exposed) where we consider an indi-vidual as being a carrier of the disease and removing the assumption that everyindividual gets the disease if they are exposed to it.

We are also able to study the SIS model where an individual goes back tobecoming susceptible after recovering from the disease. Using this model we canvary other factors to measure the duration of the disease, and introduce somefactor that would affect a person getting a disease.

We could also study the birth and death models as we assume that everyoneat the end of the disease recovers and is able to start traveling right away. Weare also assuming that over the 300-900 days there are no other individuals thatare born, which in most cases wouldn’t be true. Introducing death and birthwould increase the complexity of this model and allow us to move another stepcloser to simulating a disease close to the real world.

4.3 Vary ai and bi over time.

Our proportion of a/b stays fixed over the time of the simulation, and as theepidemic spreads from stay one city to the other the a and b values should adjustto that spread in the other cities. If we consider a model where e (epidemicity)= 1 we aren’t letting other cities grow into becoming cities with epidemics, butlooking at the change in the number of people infected because more infectedpeople travel from city 1 to the rest. As these individuals travel the values for aand b stay the same in those cities when they should be adjusting to allow forthe disease to spread naturally.

4.4 Add delay in traveling between cities, and travel

We are allowing for instantaneous travel between the different cities, whichwould allow some error to occur. This is because an individual could potentiallyexist that would travel to all four different cities within a short amount of time,which wouldn’t naturally happen. This causes the individual to go through toomany different recovery rates and therefore could give us a few errors.

4.5 Study spread of information across networks

We are able to use this simulation to simulate the spread of information acrossdifferent networks where the networks are nodes on a graph like these cities are.We have established trade between these nodes, and we are able to see howfast the information would spread across the networks similarly to the spreadof diseases.

34

Page 35: The Travelling Disease

5 References

CDC, History and Epidemiology of Global Smallpox Eradication. Available athttp://www.bt.cdc.gov/agent/smallpox/training/overview/pdf/eradicationhistory.pdf

Tuckwell, Henry C. and Ruth J. Williams, 2006, Some properties of a simplestochastic epidemic model of SIR type, Mathematical Biosciences 208, 76-97.Available at http://www.personal-homepages.mis.mpg.de/tuckwell/tuckwell2007mathbiosciwilliams.pdf

35

Page 36: The Travelling Disease

6 Appendix A: staticRates.m

1 c l e a r a l l ;2 c l f ;3 c l o s e a l l ;4

5 numCities = 4 ;6 t ime s imulated = 365 ∗ 2 ; %number o f days7 clock max = 365 ∗ 2 ; %d iv id e number o f days in to day

i n t e r v a l s8 dt = t ime s imulated / clock max ;9

10 N save = ze ro s ( numCities , clock max ) ;11 S save = ze ro s ( numCities , clock max ) ;12 I s a v e = ze ro s ( numCities , clock max ) ;13 R save = ze ro s ( numCities , clock max ) ;14 I peaks = ze ro s (1 , clock max ) ;15

16 N = [1000 500 400 1 2 0 0 ] ;17 S = [999 498 399 1 1 9 9 ] ;18 I = [ 1 2 1 1 ] ;19 R = [ 0 0 0 0 ] ;20

21 t o ta lPopu la t i on = sum(N) ;22

23 %Test ing ep idemic i ty e = 1 ,2 , 324 a2 = [ 0 . 0 5 0 .02 0 .3 0 . 2 8 ] ; % i n f e c t i v i t y a = # of new

ca s e s per day caused by one i n f e c t e d person . %timetaken to r ecove r per person i s 1/b

25 a1 = [ 0 . 0 5 0 .02 0 .04 0 . 2 8 ] ;26 a3 = [ 0 . 0 5 0 .15 0 .3 0 . 2 8 ] ;27 %b = [ 0 . 0 7 0 .03 0 .06 0 . 0 4 ] ;28

29 % Defau l t r a t e s30 % Just a normal t r a v e l case where we have e s t a b l i s h e d SR(

a l l ) > I ( a l l )31 TravelSR = [ 0 0 .1 0 .3 0 . 0 9 ; 0 .19 0 0 .10 0 . 1 0 ; 0 .29 0 .15 0

0 . 2 0 ; 0 . 1 0 . 2 0 .03 0 ] ;32 Trave l I = [ 0 0 .05 0 .1 0 . 1 2 ; 0 .01 0 0 .03 0 . 0 9 ; 0 .11 0 .04 0

0 . 0 9 ; 0 .11 0 .10 0 .07 0 ] ;33 a = [ 0 . 1 5 0 .12 0 .09 0 . 1 1 ] ;34 b = [ 0 . 0 1 0 .01 0 .01 0 . 0 1 ] ;35

36 %F SR > F I , F SR = F I , F SR < F I37 % Normal Test Case 238 % Case where SR/ I are the same39 TravelSR2 = [ 0 0 .1 0 .3 0 . 0 9 ; 0 .19 0 0 .10 0 . 1 0 ; 0 .29 0 .15

0 0 . 2 0 ; 0 . 1 0 .2 0 .03 0 ] ;40 Trave l I2 = [ 0 0 .1 0 .3 0 . 0 9 ; 0 .19 0 0 .10 0 . 1 0 ; 0 .29 0 .15 0

36

Page 37: The Travelling Disease

0 . 2 0 ; 0 . 1 0 . 2 0 .03 0 ] ;41

42 % Normal Test Case 343 % A s c e n a r i o where I ( a l l ) > SR( a l l ) because people who

are s i c k are k icked44 % out o f the c i t y and j u s t t r a v e l to d i f f e r e n t c i t i e s

s e e i n g r e fuge but no45 % one g i v e s them re fuge .46 TravelSR3 = [ 0 0 .05 0 .1 0 . 1 2 ; 0 .01 0 0 .03 0 . 0 9 ; 0 .11 0 .04

0 0 . 0 9 ; 0 .11 0 .10 0 .07 0 ] ;47 Trave l I3 = [ 0 0 .1 0 .3 0 . 0 9 ; 0 .19 0 0 .10 0 . 1 0 ; 0 .29 0 .15 0

0 . 2 0 ; 0 . 1 0 . 2 0 .03 0 ] ;48

49 % Normal Test Case 450 % 0 are the h i ghe s t l e a v i n g and lowest coming in51 % a l l t r a v e l r a t e s are equal (n = 4 same t r a v e l r a t e )52 TravelSR4 = [ 0 0 .1 0 .1 0 . 1 ; 0 . 1 0 0 .1 0 . 1 ; 0 . 1 0 .1 0 0 . 1 ;

0 . 1 0 .1 0 . 1 0 ] ;53 Trave l I4 = [ 0 0 .1 0 .1 0 . 1 ; 0 . 1 0 0 .1 0 . 1 ; 0 . 1 0 . 1 0 0 . 1 ;

0 . 1 0 .1 0 . 1 0 ] ;54

55 % n = 156 % 1 are the h i ghe s t l e a v i n g and lowest coming in57 % 3 of them have equal t r a v e l r a t e s58 % high number coming in , smal l number l e a v i n g59 TravelSR5 = [ 0 0 .05 0 .05 0 . 0 5 ; 0 . 1 0 0 .1 0 . 1 ; 0 . 1 0 .1 0

0 . 1 ; 0 . 1 0 .1 0 . 1 0 ] ;60 Trave l I5 = [ 0 0 .05 0 .05 0 . 0 5 ; 0 . 1 0 0 .1 0 . 1 ; 0 . 1 0 . 1 0

0 . 1 ; 0 . 1 0 .1 0 . 1 0 ] ;61

62 % n = 263 % 2 are the h i ghe s t l e a v i n g and lowest coming in64 % 2 of them have equal t r a v e l r a t e s65 TravelSR6 = [ 0 0 .05 0 .05 0 . 0 5 ; 0 .05 0 0 .05 0 . 0 5 ; 0 . 1 0 .1

0 0 . 1 ; 0 . 1 0 .1 0 . 1 0 ] ;66 Trave l I6 = [ 0 0 .05 0 .05 0 . 0 5 ; 0 .05 0 0 .05 0 . 0 5 ; 0 . 1 0 . 1 0

0 . 1 ; 0 . 1 0 .1 0 . 1 0 ] ;67

68 % n = 369 % 3 are the h i ghe s t l e a v i n g and lowest coming in70 % 1 c i t y has the maximial t r a v e l r a t e s71 TravelSR7 = [ 0 0 .05 0 .05 0 . 0 5 ; 0 .05 0 0 .05 0 . 0 5 ; 0 .05

0 .05 0 0 . 0 5 ; 0 . 1 0 .1 0 .1 0 ] ;72 Trave l I7 = [ 0 0 .05 0 .05 0 . 0 5 ; 0 .05 0 0 .05 0 . 0 5 ; 0 .05 0 .05

0 0 . 0 5 ; 0 . 1 0 .1 0 . 1 0 ] ;73

74 s t a r t edTrave l = f a l s e ;75

76 f i g u r e ;77 s e t ( gcf , ’ double ’ , ’ on ’ ) ;

37

Page 38: The Travelling Disease

78 subplot (3 , 3 , 1) ;79 p i e 1 = p ie ( [ S (1 ) / to ta lPopu la t i on I (1 ) / to ta lPopu la t i on R

(1) / to ta lPopu la t i on ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

80 t i t l e ( s t r c a t ( ’ City 1 , a = ’ , num2str ( a (1 ) ) , ’ , b = ’ ,num2str (b (1 ) ) ) ) ;

81 subplot (3 , 3 , 3) ;82 p i e 2 = p ie ( [ S (2 ) / to ta lPopu la t i on I (2 ) / to ta lPopu la t i on R

(2) / to ta lPopu la t i on ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

83 t i t l e ( s t r c a t ( ’ City 2 , a = ’ , num2str ( a (2 ) ) , ’ , b = ’ ,num2str (b (2 ) ) ) ) ;

84 subplot (3 , 3 , 7) ;85 p i e 3 = p ie ( [ S (3 ) / to ta lPopu la t i on I (3 ) / to ta lPopu la t i on R

(3) / to ta lPopu la t i on ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

86 t i t l e ( s t r c a t ( ’ City 3 , a = ’ , num2str ( a (3 ) ) , ’ , b = ’ ,num2str (b (3 ) ) ) ) ;

87 subplot (3 , 3 , 9) ;88 p i e 4 = p ie ( [ S (4 ) / to ta lPopu la t i on I (4 ) / to ta lPopu la t i on R

(4) / to ta lPopu la t i on ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

89 t i t l e ( s t r c a t ( ’ City 4 , a = ’ , num2str ( a (4 ) ) , ’ , b = ’ ,num2str (b (4 ) ) ) ) ;

90 subplot (3 , 3 , 5) ;91 p i e 5 = p ie ( [ ( S (4 ) / to ta lPopu la t i on + S (3) / to ta lPopu la t i on

+ S (2) / to ta lPopu la t i on + S (1) / to ta lPopu la t i on ) ( I (4 ) /to ta lPopu la t i on + I (3 ) / to ta lPopu la t i on + I (2 ) /to ta lPopu la t i on + I (1 ) / to ta lPopu la t i on ) (R(4) /to ta lPopu la t i on + R(3) / to ta lPopu la t i on + R(2) /to ta lPopu la t i on + R(1) / to ta lPopu la t i on ) ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

92 t i t l e ( ’ Global ’ ) ;93 drawnow ;94 hold on ;95

96 f o r c l o ck = 1 : clock max97 t = c l o ck ∗ dt ;98 % Allow each system to evo lve be f o r e c o n s i d e r i n g

changes in populat ion99 % due to t r a f f i c .

100 i f ( t >= ( t ime s imulated / 8) )101 s t a r t edTrave l = true ;102 end103

104 i f s t a r t edTrave l105 f o r c = 1 : numCities106 %Consider each s u s c e p t i b l e , i n f e c t ed , and

recovered i n d i v i d u a l107 %P r o b a b i l i s t i c a l l y move from S to I or from I

38

Page 39: The Travelling Disease

to R108

109 newlyIn f ec ted = 0 ;110 f o r s = 1 : S( c )111 i f ( rand < ( dt ∗ a ( c ) ∗ I ( c ) / N( c ) ) )112 newlyIn f ec ted = newlyIn fec ted + 1 ;113 end114 end115 newlyRecovered = 0 ;116 f o r i = 1 : I ( c )117 i f ( rand < dt ∗ b( c ) )118 newlyRecovered = newlyRecovered + 1 ;119 end120 end121

122 S( c ) = S( c ) − newlyIn f ec ted ;123 I ( c ) = I ( c ) + newlyIn f ec ted − newlyRecovered ;124 R( c ) = R( c ) + newlyRecovered ;125

126 end127 end128

129 f o r i = 1 : numCities130 f o r j = i +1: numCities131 % Count t r a f f i c en t e r i ng and l e a v i n g c i t y

ordered tup l e ( i , j )132 i f ( i ˜= j )133 % i −> j134 i n i t S = S( i ) ;135 f o r s = 1 : S( i )136 i f rand < ( TravelSR ( i , j ) ∗ dt )

&& (S( i ) ˜= 0 && (sum(N) >= R(j ) + I ( j ) + S( j ) ) )

137 %Only move from i to j i fbounds a l low one person to

be removed from i and oneperson

138 %to be addded to j139 S( i ) = S( i ) − 1 ;140 S( j ) = S( j ) + 1 ;141 end142 end143

144 f o r i n f = 1 : I ( i )145 i f rand < ( Trave l I ( i , j ) ∗ dt ) &&

( I ( i ) ˜= 0 && (sum(N) >= R( j )+ I ( j ) + S( j ) ) )

146 I ( i ) = I ( i ) − 1 ;147 I ( j ) = I ( j ) + 1 ;148 end

39

Page 40: The Travelling Disease

149 end150

151 f o r r = 1 :R( i )152 i f rand < ( TravelSR ( i , j ) ∗ dt )

&& (R( i ) ˜= 0 && (sum(N) >= R( j ) + I ( j ) + S( j ) ) )

153 R( i ) = R( i ) − 1 ;154 R( j ) = R( j ) + 1 ;155 end156 end157

158 % j −> i159

160 f o r s = 1 : S( j )161 i f rand < ( TravelSR ( j , i ) ∗ dt )

&& (S( j ) ˜= 0 && (sum(N) >= R(i ) + I ( i ) + S( i ) ) )

162 S( j ) = S( j ) − 1 ;163 S( i ) = S( i ) + 1 ;164 end165 end166

167 newS = S( i ) ;168 f o r i n f = 1 : I ( j )169 i f rand < ( Trave l I ( j , i ) ∗ dt ) &&

( I ( j ) ˜= 0 && (sum(N) >= R( i )+ I ( i ) + S( i ) ) )

170 I ( j ) = I ( j ) − 1 ;171 I ( i ) = I ( i ) + 1 ;172 end173 end174

175 f o r r = 1 :R( j )176 i f rand < ( TravelSR ( j , i ) ∗ dt )

&& (R( j ) ˜= 0 && (sum(N) >= R( i ) + I ( i ) + S( i ) ) )

177 R( j ) = R( j ) − 1 ;178 R( i ) = R( i ) + 1 ;179 end180 end181 end182

183 end184 end185

186 f o r i = 1 : numCities187 N save ( i , c l o ck ) = S( i )+I ( i )+R( i ) ;188 S save ( i , c l o ck ) = S( i ) ;189 I s a v e ( i , c l o ck ) = I ( i ) ;190 R save ( i , c l o ck ) = R( i ) ;

40

Page 41: The Travelling Disease

191 I peaks (1 , c l o ck ) = I s a v e ( i , c l o ck ) + I peaks(1 , c l o ck ) ;

192 end193

194 %Draw p ie chart195 c l f ( ’ r e s e t ’ )196

197 subplot (3 , 3 , 1) ;198 p i e 1 = p ie ( [ S (1 ) / to ta lPopu la t i on I (1 ) /

to ta lPopu la t i on R(1) / to ta lPopu la t i on ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

199 t i t l e ( s t r c a t ( ’ City 1 , a = ’ , num2str ( a (1 ) ) , ’ , b = ’ ,num2str (b (1 ) ) ) ) ;

200 subplot (3 , 3 , 3) ;201 p i e 2 = p ie ( [ S (2 ) / to ta lPopu la t i on I (2 ) /

to ta lPopu la t i on R(2) / to ta lPopu la t i on ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

202 t i t l e ( s t r c a t ( ’ City 2 , a = ’ , num2str ( a (2 ) ) , ’ , b = ’ ,num2str (b (2 ) ) ) ) ;

203 subplot (3 , 3 , 7) ;204 p i e 3 = p ie ( [ S (3 ) / to ta lPopu la t i on I (3 ) /

to ta lPopu la t i on R(3) / to ta lPopu la t i on ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

205 t i t l e ( s t r c a t ( ’ City 3 , a = ’ , num2str ( a (3 ) ) , ’ , b = ’ ,num2str (b (3 ) ) ) ) ;

206 subplot (3 , 3 , 9) ;207 p i e 4 = p ie ( [ S (4 ) / to ta lPopu la t i on I (4 ) /

to ta lPopu la t i on R(4) / to ta lPopu la t i on ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

208 t i t l e ( s t r c a t ( ’ City 4 , a = ’ , num2str ( a (4 ) ) , ’ , b = ’ ,num2str (b (4 ) ) ) ) ;

209 subplot (3 , 3 , 5) ;210 p i e 5 = p ie ( [ ( S (4 ) / to ta lPopu la t i on + S (3) /

to ta lPopu la t i on + S (2) / to ta lPopu la t i on + S (1) /to ta lPopu la t i on ) ( I (4 ) / to ta lPopu la t i on + I (3 ) /to ta lPopu la t i on + I (2 ) / to ta lPopu la t i on + I (1 ) /to ta lPopu la t i on ) (R(4) / to ta lPopu la t i on + R(3) /to ta lPopu la t i on + R(2) / to ta lPopu la t i on + R(1) /to ta lPopu la t i on ) ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

211 t i t l e ( ’ Global ’ ) ;212 drawnow ;213 hold o f f ;214

215 end216

217 %Output s t a t i c data218 f i g u r e ;219 U = 1.2 ∗ t ime s imulated ;220 s e t ( gcf , ’ double ’ , ’ on ’ ) ;

41

Page 42: The Travelling Disease

221 % −−− S u s c e p t i b l e −−− %222 L = 1.1 ∗ max( S save ( : ) ) ;223 subplot (4 , 4 , 1) ;224 p lo t ( S save ( 1 , 1 : c l o ck ) )225 t i t l e ( ’ S u s c e p t i b l e 1 ’ ) ;226 a x i s ( [ 0 U 0 L ] ) ;227 subplot (4 , 4 , 2) ;228 p lo t ( S save ( 2 , 1 : c l o ck ) )229 t i t l e ( ’ S u s c e p t i b l e 2 ’ ) ;230 a x i s ( [ 0 U 0 L ] ) ;231 subplot (4 , 4 , 3) ;232 p lo t ( S save ( 3 , 1 : c l o ck ) )233 t i t l e ( ’ S u s c e p t i b l e 3 ’ ) ;234 a x i s ( [ 0 U 0 L ] ) ;235 subplot (4 , 4 , 4) ;236 p lo t ( S save ( 4 , 1 : c l o ck ) )237 t i t l e ( ’ S u s c e p t i b l e 4 ’ ) ;238 a x i s ( [ 0 U 0 L ] ) ;239

240 % −−− I n f e c t e d −−− %241 L = 1.1 ∗ max( I s a v e ( : ) ) ;242 subplot (4 , 4 , 5) ;243 p lo t ( I s a v e ( 1 , 1 : c l o ck ) )244 t i t l e ( ’ I n f e c t e d 1 ’ ) ;245 a x i s ( [ 0 U 0 L ] ) ;246 subplot (4 , 4 , 6) ;247 p lo t ( I s a v e ( 2 , 1 : c l o ck ) )248 t i t l e ( ’ I n f e c t e d 2 ’ ) ;249 a x i s ( [ 0 U 0 L ] ) ;250 subplot (4 , 4 , 7) ;251 p lo t ( I s a v e ( 3 , 1 : c l o ck ) )252 t i t l e ( ’ I n f e c t e d 3 ’ ) ;253 a x i s ( [ 0 U 0 L ] ) ;254 subplot (4 , 4 , 8) ;255 p lo t ( I s a v e ( 4 , 1 : c l o ck ) )256 t i t l e ( ’ I n f e c t e d 4 ’ ) ;257 a x i s ( [ 0 U 0 L ] ) ;258

259 % −−− Recovered −−− %260 L = 1.1 ∗ max( R save ( : ) ) ;261 subplot (4 , 4 , 9) ;262 p lo t ( R save ( 1 , 1 : c l o ck ) )263 t i t l e ( ’ Recovered 1 ’ ) ;264 a x i s ( [ 0 U 0 L ] ) ;265 subplot (4 , 4 , 10) ;266 p lo t ( R save ( 2 , 1 : c l o ck ) )267 t i t l e ( ’ Recovered 2 ’ ) ;268 a x i s ( [ 0 U 0 L ] ) ;269 subplot (4 , 4 , 11) ;270 p lo t ( R save ( 3 , 1 : c l o ck ) )

42

Page 43: The Travelling Disease

271 t i t l e ( ’ Recovered 3 ’ ) ;272 a x i s ( [ 0 U 0 L ] ) ;273 subplot (4 , 4 , 12) ;274 p lo t ( R save ( 4 , 1 : c l o ck ) )275 t i t l e ( ’ Recovered 4 ’ ) ;276 a x i s ( [ 0 U 0 L ] ) ;277

278 % −−− General populat ion −−− %279 L = 1.1 ∗ max( N save ( : ) ) ;280 subplot (4 , 4 , 13) ;281 p lo t ( N save ( 1 , 1 : c l o ck ) )282 t i t l e ( ’ City Pop 1 ’ ) ;283 a x i s ( [ 0 U 0 L ] ) ;284 subplot (4 , 4 , 14) ;285 p lo t ( N save ( 2 , 1 : c l o ck ) )286 t i t l e ( ’ City Pop 2 ’ ) ;287 a x i s ( [ 0 U 0 L ] ) ;288 subplot (4 , 4 , 15) ;289 p lo t ( N save ( 3 , 1 : c l o ck ) )290 t i t l e ( ’ City Pop 3 ’ ) ;291 a x i s ( [ 0 U 0 L ] ) ;292 subplot (4 , 4 , 16) ;293 p lo t ( N save ( 4 , 1 : c l o ck ) )294 t i t l e ( ’ City Pop 4 ’ ) ;295 a x i s ( [ 0 U 0 L ] ) ;

43

Page 44: The Travelling Disease

7 Appendix B: thresholds.m

1 c l e a r a l l ;2 c l f ;3 c l o s e a l l ;4

5 numCities = 4 ;6 t ime s imulated = 365 ∗ 2 ; %number o f days7 clock max = 365 ∗ 4 ; %d iv id e number o f days in to ha l f−day

i n t e r v a l s8 dt = t ime s imulated / clock max ;9

10 N save = ze ro s ( numCities , clock max ) ;11 S save = ze ro s ( numCities , clock max ) ;12 I s a v e = ze ro s ( numCities , clock max ) ;13 R save = ze ro s ( numCities , clock max ) ;14

15 I peaks = ze ro s (1 , clock max ) ;16

17 N = [1000 500 400 1 2 0 0 ] ;18 S = [999 498 399 1 1 9 9 ] ;19 I = [ 1 2 1 1 ] ;20 R = [ 0 0 0 0 ] ;21

22 t o ta lPopu la t i on = sum(N) ;23

24 %Test ing thre sho lds , R 0 = 1 .25 a = [ 0 . 0 7 0 .03 0 .06 0 . 0 4 ] ;26 b = [ 0 . 0 7 0 .03 0 .06 0 . 0 4 ] ;27 TravelSR = [ 0 0 .1 0 .22 0 . 0 9 ; 0 .19 0 0 .10 0 . 1 0 ; 0 .21 0 .15

0 0 . 2 0 ; 0 . 1 0 .2 0 .03 0 ] ;28 Trave l I = [ 0 0 .05 0 .1 0 . 1 2 ; 0 .01 0 0 .03 0 . 0 9 ; 0 .11 0 .04 0

0 . 0 9 ; 0 .11 0 .10 0 .07 0 ] ;29

30 %Test ing R 0 > 1 , e = 1 .31 %TravelSR = [ 0 0 .013 0 .027 0 . 0 3 ; 0 .032 0 0 .022 0 . 0 1 6 ;

0 .015 0 .04 0 0 . 0 5 ; 0 .067 0 .076 0 .045 0 ] ;32 %Trave l I = [ 0 0 .012 0 .018 0 . 0 1 9 ; 0 .01 0 0 .03 0 . 0 9 ; 0 .08

0 .05 0 0 . 0 1 1 ; 0 .051 0 .042 0 .017 0 ] ;33

34 k = 50 ;35 f o r i = 1 : numCities36 f o r j = 1 : numCities37 i f ( i ˜= j )38 TravelSR ( i , j ) = TravelSR ( i , j ) + k ∗ 0 . 0 0 3 ;39 Trave l I ( i , j ) = Trave l I ( i , j ) + k ∗ 0 . 0 0 3 ;40 end41 end42 end

44

Page 45: The Travelling Disease

43

44 s t a r t edTrave l = f a l s e ;45 i n f ec tedCounter = 0 ;46

47 f i g u r e ;48 s e t ( gcf , ’ double ’ , ’ on ’ ) ;49 subplot (3 , 3 , 1) ;50 p i e 1 = p ie ( [ S (1 ) / to ta lPopu la t i on I (1 ) / to ta lPopu la t i on R

(1) / to ta lPopu la t i on ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

51 t i t l e ( s t r c a t ( ’ City 1 , a = ’ , num2str ( a (1 ) ) , ’ , b = ’ ,num2str (b (1 ) ) ) ) ;

52 subplot (3 , 3 , 3) ;53 p i e 2 = p ie ( [ S (2 ) / to ta lPopu la t i on I (2 ) / to ta lPopu la t i on R

(2) / to ta lPopu la t i on ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

54 t i t l e ( s t r c a t ( ’ City 2 , a = ’ , num2str ( a (2 ) ) , ’ , b = ’ ,num2str (b (2 ) ) ) ) ;

55 subplot (3 , 3 , 7) ;56 p i e 3 = p ie ( [ S (3 ) / to ta lPopu la t i on I (3 ) / to ta lPopu la t i on R

(3) / to ta lPopu la t i on ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

57 t i t l e ( s t r c a t ( ’ City 3 , a = ’ , num2str ( a (3 ) ) , ’ , b = ’ ,num2str (b (3 ) ) ) ) ;

58 subplot (3 , 3 , 9) ;59 p i e 4 = p ie ( [ S (4 ) / to ta lPopu la t i on I (4 ) / to ta lPopu la t i on R

(4) / to ta lPopu la t i on ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

60 t i t l e ( s t r c a t ( ’ City 4 , a = ’ , num2str ( a (4 ) ) , ’ , b = ’ ,num2str (b (4 ) ) ) ) ;

61 subplot (3 , 3 , 5) ;62 p i e 5 = p ie ( [ ( S (4 ) / to ta lPopu la t i on + S (3) / to ta lPopu la t i on

+ S (2) / to ta lPopu la t i on + S (1) / to ta lPopu la t i on ) ( I (4 ) /to ta lPopu la t i on + I (3 ) / to ta lPopu la t i on + I (2 ) /to ta lPopu la t i on + I (1 ) / to ta lPopu la t i on ) (R(4) /to ta lPopu la t i on + R(3) / to ta lPopu la t i on + R(2) /to ta lPopu la t i on + R(1) / to ta lPopu la t i on ) ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

63 t i t l e ( ’ Global ’ ) ;64 drawnow ;65 hold on ;66

67 f o r c l o ck = 1 : clock max68 t = c l o ck ∗ dt ;69 i f ( t >= ( t ime s imulated / 8) )70 s t a r t edTrave l = true ;71 end72

73 i f s t a r t edTrave l74 f o r c = 1 : numCities

45

Page 46: The Travelling Disease

75 %Consider each s u s c e p t i b l e , i n f e c t ed , andrecovered i n d i v i d u a l

76 %P r o b a b i l i s t i c a l l y move from S to I or from Ito R

77 newlyIn f ec ted = 0 ;78

79 f o r s = 1 : S( c )80 i f ( rand < ( dt ∗ a ( c ) ∗ I ( c ) / N( c ) ) )81 newlyIn f ec ted = newlyIn fec ted + 1 ;82 counter = counter + 1 ;83 end84 end85 newlyRecovered = 0 ;86 f o r i = 1 : I ( c )87 i f ( rand < dt ∗ b( c ) )88 newlyRecovered = newlyRecovered + 1 ;89 end90 end91

92 S( c ) = S( c ) − newlyIn f ec ted ;93 I ( c ) = I ( c ) + newlyIn f ec ted − newlyRecovered ;94 R( c ) = R( c ) + newlyRecovered ;95

96 end97 end98

99 f o r i = 1 : numCities100 f o r j = i +1: numCities101 % Count t r a f f i c en t e r i ng and l e a v i n g

ordered tup l e ( i , j )102 i f ( i ˜= j )103 % i −> j104 i n i t S = S( i ) ;105 f o r s = 1 : S( i )106 i f rand < ( TravelSR ( i , j ) ∗ dt )

&& (S( i ) ˜= 0 && (sum(N) >= R(j ) + I ( j ) + S( j ) ) )

107 %Only move from i to j i fbounds a l low one person to

be removed from i and oneperson

108 %to be addded to j109 S( i ) = S( i ) − 1 ;110 S( j ) = S( j ) + 1 ;111 end112 end113

114 f o r i n f = 1 : I ( i )115 i f rand < ( Trave l I ( i , j ) ∗ dt ) &&

( I ( i ) ˜= 0 && (sum(N) >= R( j )

46

Page 47: The Travelling Disease

+ I ( j ) + S( j ) ) )116 I ( i ) = I ( i ) − 1 ;117 I ( j ) = I ( j ) + 1 ;118 end119 end120

121 f o r r = 1 :R( i )122 i f rand < ( TravelSR ( i , j ) ∗ dt )

&& (R( i ) ˜= 0 && (sum(N) >= R( j ) + I ( j ) + S( j ) ) )

123 R( i ) = R( i ) − 1 ;124 R( j ) = R( j ) + 1 ;125 end126 end127

128 % j −> i129

130 f o r s = 1 : S( j )131 i f rand < ( TravelSR ( j , i ) ∗ dt )

&& (S( j ) ˜= 0 && (sum(N) >= R(i ) + I ( i ) + S( i ) ) )

132 S( j ) = S( j ) − 1 ;133 S( i ) = S( i ) + 1 ;134 end135 end136

137 newS = S( i ) ;138 f o r i n f = 1 : I ( j )139 i f rand < ( Trave l I ( j , i ) ∗ dt ) &&

( I ( j ) ˜= 0 && (sum(N) >= R( i )+ I ( i ) + S( i ) ) )

140 I ( j ) = I ( j ) − 1 ;141 I ( i ) = I ( i ) + 1 ;142 end143 end144

145 f o r r = 1 :R( j )146 i f rand < ( TravelSR ( j , i ) ∗ dt )

&& (R( j ) ˜= 0 && (sum(N) >= R( i ) + I ( i ) + S( i ) ) )

147 R( j ) = R( j ) − 1 ;148 R( i ) = R( i ) + 1 ;149 end150 end151 end152

153 end154

155 end156

47

Page 48: The Travelling Disease

157 f o r i = 1 : numCities158 N save ( i , c l o ck ) = S( i )+I ( i )+R( i ) ;159 S save ( i , c l o ck ) = S( i ) ;160 I s a v e ( i , c l o ck ) = I ( i ) ;161 R save ( i , c l o ck ) = R( i ) ;162 I peaks (1 , c l o ck ) = I s a v e ( i , c l o ck ) + I peaks

(1 , c l o ck ) ;163 end164

165 %Draw p ie char t s166 c l f ( ’ r e s e t ’ )167

168 subplot (3 , 3 , 1) ;169 p i e 1 = p ie ( [ S (1 ) / to ta lPopu la t i on I (1 ) /

to ta lPopu la t i on R(1) / to ta lPopu la t i on ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

170 t i t l e ( s t r c a t ( ’ City 1 , a = ’ , num2str ( a (1 ) ) , ’ , b = ’ ,num2str (b (1 ) ) ) ) ;

171 subplot (3 , 3 , 3) ;172 p i e 2 = p ie ( [ S (2 ) / to ta lPopu la t i on I (2 ) /

to ta lPopu la t i on R(2) / to ta lPopu la t i on ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

173 t i t l e ( s t r c a t ( ’ City 2 , a = ’ , num2str ( a (2 ) ) , ’ , b = ’ ,num2str (b (2 ) ) ) ) ;

174 subplot (3 , 3 , 7) ;175 p i e 3 = p ie ( [ S (3 ) / to ta lPopu la t i on I (3 ) /

to ta lPopu la t i on R(3) / to ta lPopu la t i on ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

176 t i t l e ( s t r c a t ( ’ City 3 , a = ’ , num2str ( a (3 ) ) , ’ , b = ’ ,num2str (b (3 ) ) ) ) ;

177 subplot (3 , 3 , 9) ;178 p i e 4 = p ie ( [ S (4 ) / to ta lPopu la t i on I (4 ) /

to ta lPopu la t i on R(4) / to ta lPopu la t i on ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

179 t i t l e ( s t r c a t ( ’ City 4 , a = ’ , num2str ( a (4 ) ) , ’ , b = ’ ,num2str (b (4 ) ) ) ) ;

180 subplot (3 , 3 , 5) ;181 p i e 5 = p ie ( [ ( S (4 ) / to ta lPopu la t i on + S (3) /

to ta lPopu la t i on + S (2) / to ta lPopu la t i on + S (1) /to ta lPopu la t i on ) ( I (4 ) / to ta lPopu la t i on + I (3 ) /to ta lPopu la t i on + I (2 ) / to ta lPopu la t i on + I (1 ) /to ta lPopu la t i on ) (R(4) / to ta lPopu la t i on + R(3) /to ta lPopu la t i on + R(2) / to ta lPopu la t i on + R(1) /to ta lPopu la t i on ) ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

182 t i t l e ( ’ Global ’ ) ;183 drawnow ;184 hold o f f ;185

186 end

48

Page 49: The Travelling Disease

187

188 %Output s t a t i c data189 f i g u r e ;190 t i t l e ( s t r c a t ( s t r c a t ( s t r c a t ( ’ dt = ’ , num2str ( dt ) ) , ’ k = ’ )

, num2str ( k ) ) ) ;191 s e t ( gcf , ’ double ’ , ’ on ’ ) ;192 U = 1.2 ∗ t ime s imulated ;193 x = 1 : c l o ck ;194 L = 1.1 ∗ max( I s a v e ( : ) , max( S save ( : ) , R save ( : ) ) ) ;195

196 subplot (2 , 4 , 1) ;197 p lo t (x , S save (1 , 1 : c l o ck ) , x , I s a v e (1 , 1 : c l o ck ) , x ,

R save (1 , 1 : c l o ck ) ) ;198 t i t l e ( ’ City 1 ’ ) ;199 x l a b e l ( ’Time ’ ) ;200 y l a b e l ( ’Num. o f people ’ ) ;201

202 subplot (2 , 4 , 2) ;203 p lo t (x , S save (2 , 1 : c l o ck ) , x , I s a v e (2 , 1 : c l o ck ) , x ,

R save (2 , 1 : c l o ck ) ) ;204 t i t l e ( ’ City 2 ’ ) ;205 x l a b e l ( ’Time ’ ) ;206 y l a b e l ( ’Num. o f people ’ ) ;207 subplot (2 , 4 , 3) ;208 p lo t (x , S save (3 , 1 : c l o ck ) , x , I s a v e (3 , 1 : c l o ck ) , x ,

R save (3 , 1 : c l o ck ) ) ;209 t i t l e ( ’ City 3 ’ ) ;210 x l a b e l ( ’Time ’ ) ;211 y l a b e l ( ’Num. o f people ’ ) ;212 subplot (2 , 4 , 4) ;213 p lo t (x , S save (4 , 1 : c l o ck ) , x , I s a v e (4 , 1 : c l o ck ) , x ,

R save (4 , 1 : c l o ck ) ) ;214 t i t l e ( ’ City 4 ’ ) ;215 x l a b e l ( ’Time ’ ) ;216 y l a b e l ( ’Num. o f people ’ ) ;217

218 % −−− General populat ion −−− %219 L = 1.1 ∗ max( N save ( : ) ) ;220 subplot (2 , 4 , 5) ;221 p lo t ( N save ( 1 , 1 : c l o ck ) )222 t i t l e ( ’ Total Populat ion in City 1 ’ ) ;223 x l a b e l ( ’Time ’ ) ;224 y l a b e l ( ’Num. o f people ’ ) ;225 a x i s ( [ 0 U 0 L ] ) ;226 subplot (2 , 4 , 6) ;227 p lo t ( N save ( 2 , 1 : c l o ck ) )228 t i t l e ( ’ Total Populat ion in City 2 ’ ) ;229 x l a b e l ( ’Time ’ ) ;230 y l a b e l ( ’Num. o f people ’ ) ;231 a x i s ( [ 0 U 0 L ] ) ;

49

Page 50: The Travelling Disease

232 subplot (2 , 4 , 7) ;233 p lo t ( N save ( 3 , 1 : c l o ck ) )234 t i t l e ( ’ Total Populat ion in City 3 ’ ) ;235 x l a b e l ( ’Time ’ ) ;236 y l a b e l ( ’Num. o f people ’ ) ;237 a x i s ( [ 0 U 0 L ] ) ;238 subplot (2 , 4 , 8) ;239 p lo t ( N save ( 4 , 1 : c l o ck ) )240 t i t l e ( ’ Total Populat ion in City 4 ’ ) ;241 x l a b e l ( ’Time ’ ) ;242 y l a b e l ( ’Num. o f people ’ ) ;243 a x i s ( [ 0 U 0 L ] ) ;

8 Appendix C: dynamicRates.m

1

2 c l e a r a l l ;3 c l f ;4 c l o s e a l l ;5

6 numCities = 4 ;7 t ime s imulated = 365 ; %number o f days8 clock max = 365 ; %d iv id e number o f days in to day

i n t e r v a l s9 dt = t ime s imulated / clock max ;

10

11 N save = ze ro s ( numCities , clock max ) ;12 S save = ze ro s ( numCities , clock max ) ;13 I s a v e = ze ro s ( numCities , clock max ) ;14 R save = ze ro s ( numCities , clock max ) ;15 I peaks = ze ro s (1 , clock max ) ;16

17 N = [1000 500 400 1 2 0 0 ] ;18 S = [999 498 399 1 1 9 9 ] ;19 I = [ 1 2 1 1 ] ;20 R = [ 0 0 0 0 ] ;21

22 t o ta lPopu la t i on = sum(N) ;23

24 a = [ 0 . 1 5 0 .12 0 .09 0 . 1 1 ] ; % i n f e c t i v i t y a = # of newca s e s per day caused by one i n f e c t e d person .

25 b = [ 0 . 0 1 0 .01 0 .01 0 . 0 1 ] ; %time taken to r ecove r perperson i s 1/b .

26

27 TravelSR = [ 0 0 .1 0 .3 0 . 0 9 ; 0 .19 0 0 .10 0 . 1 0 ; 0 .29 0 .15 00 . 2 0 ; 0 . 1 0 . 2 0 .03 0 ] ;

28 Trave l I = [ 0 0 .05 0 .1 0 . 1 2 ; 0 .01 0 0 .03 0 . 0 9 ; 0 .11 0 .04 00 . 0 9 ; 0 .11 0 .10 0 .07 0 ] ;

29

30 s t a r t edTrave l = f a l s e ;

50

Page 51: The Travelling Disease

31

32 f i g u r e ;33 s e t ( gcf , ’ double ’ , ’ on ’ ) ;34 subplot (3 , 3 , 1) ;35 p i e 1 = p ie ( [ S (1 ) / to ta lPopu la t i on I (1 ) / to ta lPopu la t i on R

(1) / to ta lPopu la t i on ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

36 t i t l e ( s t r c a t ( ’ City 1 , a = ’ , num2str ( a (1 ) ) , ’ , b = ’ ,num2str (b (1 ) ) ) ) ;

37 subplot (3 , 3 , 3) ;38 p i e 2 = p ie ( [ S (2 ) / to ta lPopu la t i on I (2 ) / to ta lPopu la t i on R

(2) / to ta lPopu la t i on ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

39 t i t l e ( s t r c a t ( ’ City 2 , a = ’ , num2str ( a (2 ) ) , ’ , b = ’ ,num2str (b (2 ) ) ) ) ;

40 subplot (3 , 3 , 7) ;41 p i e 3 = p ie ( [ S (3 ) / to ta lPopu la t i on I (3 ) / to ta lPopu la t i on R

(3) / to ta lPopu la t i on ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

42 t i t l e ( s t r c a t ( ’ City 3 , a = ’ , num2str ( a (3 ) ) , ’ , b = ’ ,num2str (b (3 ) ) ) ) ;

43 subplot (3 , 3 , 9) ;44 p i e 4 = p ie ( [ S (4 ) / to ta lPopu la t i on I (4 ) / to ta lPopu la t i on R

(4) / to ta lPopu la t i on ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

45 t i t l e ( s t r c a t ( ’ City 4 , a = ’ , num2str ( a (4 ) ) , ’ , b = ’ ,num2str (b (4 ) ) ) ) ;

46 subplot (3 , 3 , 5) ;47 p i e 5 = p ie ( [ ( S (4 ) / to ta lPopu la t i on + S (3) / to ta lPopu la t i on

+ S (2) / to ta lPopu la t i on + S (1) / to ta lPopu la t i on ) ( I (4 ) /to ta lPopu la t i on + I (3 ) / to ta lPopu la t i on + I (2 ) /to ta lPopu la t i on + I (1 ) / to ta lPopu la t i on ) (R(4) /to ta lPopu la t i on + R(3) / to ta lPopu la t i on + R(2) /to ta lPopu la t i on + R(1) / to ta lPopu la t i on ) ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

48 t i t l e ( ’ Global ’ ) ;49 hold on ;50

51 f o r c l o ck = 1 : clock max52 t = c l o ck ∗ dt ;53 % Allow each system to evo lve be f o r e c o n s i d e r i n g

changes in populat ion54 % due to t r a f f i c .55 i f ( t >= ( t ime s imulated / 8) )56 s t a r t edTrave l = true ;57 end58

59 i f s t a r t edTrave l60 f o r c = 1 : numCities61 %Consider each s u s c e p t i b l e , i n f e c t ed , and

51

Page 52: The Travelling Disease

r ecovered i n d i v i d u a l62 %P r o b a b i l i s t i c a l l y move from S to I or from I

to R63

64 newlyIn f ec ted = 0 ;65

66 f o r s = 1 : S( c )67 i f ( rand < ( dt ∗ a ( c ) ∗ I ( c ) / N( c ) ) )68 dt ∗ a ( c ) ∗ I ( c ) / N( c )69 newlyIn f ec ted = newlyIn fec ted + 1 ;70 end71 end72 newlyRecovered = 0 ;73 f o r i = 1 : I ( c )74 i f ( rand < dt ∗ b( c ) )75 dt ∗ b( c )76 newlyRecovered = newlyRecovered + 1 ;77 end78 end79

80 S( c ) = S( c ) − newlyIn f ec ted ;81 I ( c ) = I ( c ) + newlyIn f ec ted − newlyRecovered ;82 R( c ) = R( c ) + newlyRecovered ;83 end84 end85

86 f o r i = 1 : numCities87 f o r j = i +1: numCities88 % Count t r a f f i c en t e r i ng and l e a v i n g

ordered tup l e ( i , j )89 i f ( i ˜= j )90

91 biasedSR j = 0 ;92 b i a s e d I j = 0 ;93 biasedSR i = 0 ;94 b i a s e d I i = 0 ;95 i f (S ( i ) + R( i ) ) < I ( i )96 %Bias r a t e s97 biasedSR j = ( I ( i ) / N( i ) ) ;98 b i a s e d I j = ( I ( i ) / N( i ) ) ;99

100 biasedSR i = 1 − biasedSR j ;101 b i a s e d I i = 1 − b i a s e d I j ;102

103 e l s e104 %Resume s t a t i c r a t e s105 biasedSR j = TravelSR ( i , j ) ;106 b i a s t e d I j = Trave l I ( i , j ) ;107

108 biasedSR i = TravelSR ( j , i ) ;

52

Page 53: The Travelling Disease

109 b i a s e d I i = Trave l I ( j , i ) ;110

111 end112

113 % i −> j114 f o r s = 1 : S( i )115 i f rand < biasedSR j && (S( i ) ˜=

0) && (sum(N) >= R( j ) + I ( j ) +S( j ) ) )

116 %Only move from i to j i fbounds a l low one person to

be removed from i and oneperson

117 %to be addded to j118 S( i ) = S( i ) − 1 ;119 S( j ) = S( j ) + 1 ;120 end121 end122

123 f o r i n f = 1 : I ( i )124 i f rand < b i a s e d I j && ( I ( i ) ˜=

0) && (sum(N) >= R( j ) + I ( j ) +S( j ) ) )

125 I ( i ) = I ( i ) − 1 ;126 I ( j ) = I ( j ) + 1 ;127 end128 end129

130 f o r r = 1 :R( i )131 i f rand < biasedSR j && (R( i ) ˜=

0) && (sum(N) >= R( j ) + I ( j )+ S( j ) ) )

132 R( i ) = R( i ) − 1 ;133 R( j ) = R( j ) + 1 ;134 end135 end136

137 % j −> i138

139 f o r s = 1 : S( j )140 i f rand < biasedSR i && (S( j ) ˜=

0) && (sum(N) >= R( i ) + I ( i ) +S( i ) )

141 S( j ) = S( j ) − 1 ;142 S( i ) = S( i ) + 1 ;143 end144 end145

146 f o r i n f = 1 : I ( j )147 i f rand < b i a s e d I i && ( I ( j ) ˜=

53

Page 54: The Travelling Disease

0) && (sum(N) >= R( i ) + I ( i ) +S( i ) )

148 I ( j ) = I ( j ) − 1 ;149 I ( i ) = I ( i ) + 1 ;150 end151 end152

153 f o r r = 1 :R( j )154 i f rand < biasedSR i && (R( j ) ˜=

0) && (sum(N) >= R( i ) + I ( i )+ S( i ) )

155 R( j ) = R( j ) − 1 ;156 R( i ) = R( i ) + 1 ;157 end158 end159

160 end161 end162 end163

164 f o r i = 1 : numCities165 N save ( i , c l o ck ) = S( i )+I ( i )+R( i ) ;166 S save ( i , c l o ck ) = S( i ) ;167 I s a v e ( i , c l o ck ) = I ( i ) ;168 R save ( i , c l o ck ) = R( i ) ;169 I peaks (1 , c l o ck ) = I s a v e ( i , c l o ck ) + I peaks

(1 , c l o ck ) ;170 end171

172 %Draw p ie char t s173 c l f ( ’ r e s e t ’ )174

175 subplot (3 , 3 , 1) ;176 p i e 1 = p ie ( [ S (1 ) / to ta lPopu la t i on I (1 ) /

to ta lPopu la t i on R(1) / to ta lPopu la t i on ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

177 t i t l e ( s t r c a t ( ’ City 1 , a = ’ , num2str ( a (1 ) ) , ’ , b = ’ ,num2str (b (1 ) ) ) ) ;

178 subplot (3 , 3 , 3) ;179 p i e 2 = p ie ( [ S (2 ) / to ta lPopu la t i on I (2 ) /

to ta lPopu la t i on R(2) / to ta lPopu la t i on ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

180 t i t l e ( s t r c a t ( ’ City 2 , a = ’ , num2str ( a (2 ) ) , ’ , b = ’ ,num2str (b (2 ) ) ) ) ;

181 subplot (3 , 3 , 7) ;182 p i e 3 = p ie ( [ S (3 ) / to ta lPopu la t i on I (3 ) /

to ta lPopu la t i on R(3) / to ta lPopu la t i on ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

183 t i t l e ( s t r c a t ( ’ City 3 , a = ’ , num2str ( a (3 ) ) , ’ , b = ’ ,num2str (b (3 ) ) ) ) ;

54

Page 55: The Travelling Disease

184 subplot (3 , 3 , 9) ;185 p i e 4 = p ie ( [ S (4 ) / to ta lPopu la t i on I (4 ) /

to ta lPopu la t i on R(4) / to ta lPopu la t i on ] , { ’S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’ Recovered ’ }) ;

186 t i t l e ( s t r c a t ( ’ City 4 , a = ’ , num2str ( a (4 ) ) , ’ , b = ’ ,num2str (b (4 ) ) ) ) ;

187 subplot (3 , 3 , 5) ;188 p i e 5 = p ie ( [ ( S (4 ) / to ta lPopu la t i on + S (3) /

to ta lPopu la t i on + S (2) / to ta lPopu la t i on + S (1) /to ta lPopu la t i on ) ( I (4 ) / to ta lPopu la t i on + I (3 ) /to ta lPopu la t i on + I (2 ) / to ta lPopu la t i on + I (1 ) /to ta lPopu la t i on ) (R(4) / to ta lPopu la t i on + R(3) /to ta lPopu la t i on + R(2) / to ta lPopu la t i on + R(1) /to ta lPopu la t i on ) ] , { ’ S u s c e p t i b l e ’ , ’ I n f e c t e d ’ , ’Recovered ’ }) ;

189 t i t l e ( ’ Global ’ ) ;190 drawnow ;191 hold o f f ;192

193 end194

195 %Output s t a t i c data196 f i g u r e ;197 subplot (4 , 4 , 1) ;198 p lo t ( S save ( 1 , 1 : c l o ck ) )199 t i t l e ( ’ S u s c e p t i b l e 1 ’ ) ;200 subplot (4 , 4 , 2) ;201 p lo t ( S save ( 2 , 1 : c l o ck ) )202 t i t l e ( ’ S u s c e p t i b l e 2 ’ ) ;203 subplot (4 , 4 , 3) ;204 p lo t ( S save ( 3 , 1 : c l o ck ) )205 t i t l e ( ’ S u s c e p t i b l e 3 ’ ) ;206 subplot (4 , 4 , 4) ;207 p lo t ( S save ( 4 , 1 : c l o ck ) )208 t i t l e ( ’ S u s c e p t i b l e 4 ’ ) ;209 subplot (4 , 4 , 5) ;210 p lo t ( I s a v e ( 1 , 1 : c l o ck ) )211 t i t l e ( ’ I n f e c t e d 1 ’ ) ;212 subplot (4 , 4 , 6) ;213 p lo t ( I s a v e ( 2 , 1 : c l o ck ) )214 t i t l e ( ’ I n f e c t e d 2 ’ ) ;215 subplot (4 , 4 , 7) ;216 p lo t ( I s a v e ( 3 , 1 : c l o ck ) )217 t i t l e ( ’ I n f e c t e d 3 ’ ) ;218 subplot (4 , 4 , 8) ;219 p lo t ( I s a v e ( 4 , 1 : c l o ck ) )220 t i t l e ( ’ I n f e c t e d 4 ’ ) ;221 subplot (4 , 4 , 9) ;222 p lo t ( R save ( 1 , 1 : c l o ck ) )223 t i t l e ( ’ Recovered 1 ’ ) ;

55

Page 56: The Travelling Disease

224 subplot (4 , 4 , 10) ;225 p lo t ( R save ( 2 , 1 : c l o ck ) )226 t i t l e ( ’ Recovered 2 ’ ) ;227 subplot (4 , 4 , 11) ;228 p lo t ( R save ( 3 , 1 : c l o ck ) )229 t i t l e ( ’ Recovered 3 ’ ) ;230 subplot (4 , 4 , 12) ;231 p lo t ( R save ( 4 , 1 : c l o ck ) )232 t i t l e ( ’ Recovered 4 ’ ) ;233 subplot (4 , 4 , 13) ;234 p lo t ( N save ( 1 , 1 : c l o ck ) )235 t i t l e ( ’ City Pop 1 ’ ) ;236 subplot (4 , 4 , 14) ;237 p lo t ( N save ( 2 , 1 : c l o ck ) )238 t i t l e ( ’ City Pop 2 ’ ) ;239 subplot (4 , 4 , 15) ;240 p lo t ( N save ( 3 , 1 : c l o ck ) )241 t i t l e ( ’ City Pop 3 ’ ) ;242 subplot (4 , 4 , 16) ;243 p lo t ( N save ( 4 , 1 : c l o ck ) )244 t i t l e ( ’ City Pop 4 ’ ) ;

56