epiDEM Travel and Control

epiDEM Travel and Control preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

ccl 

Tagged by Modeling Commons System almost 13 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 928 times • Downloaded 58 times • Run 0 times
Download the 'epiDEM Travel and Control' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This model is an extension of the basic model of epiDEM (a curricular unit which stands for Epidemiology: Understanding Disease Dynamics and Emergence through Modeling). It simulates the spread of an infectious disease in a semi-closed population, but with additional features such as travel, isolation, quarantine, inoculation, and links between individuals. However, we still assume that the virus does not mutate, and that upon recovery, an individual will have perfect immunity.

Overall, this model helps users:
1) understand the emergent disease spread dynamics in relation to the changes in control measures, travel, and mobility
2) understand how the reproduction number, R_0, represents the threshold for an epidemic 3) understand the relationship between derivatives and integrals, represented simply as rates and cumulative number of cases, and
4) provide opportunities to extend or change the model to include some properties of a disease that interest users the most.

HOW IT WORKS

Individuals wander around the world in random motion. There are two groups of individuals, represented as either squares or circles, and are geographically divided by the yellow border. Upon coming into contact with an infected person, he or she has a chance of contracting the illness. Depending on their tendencies, which are set by the user, sick individuals will either isolate themselves at "home," go to a hospital, be force-quarantined into a hospital by health officials, or just move about. An infected individual has a chance of recovery after the given recovery time has elapsed.

The presence of the virus in the population is represented by the colors of individuals. Four colors are used: white individuals are uninfected, red individuals are infected, green individuals are recovered, and blue individuals are inoculated. Once recovered, the individual is permanently immune to the virus. The yellow person symbolizes the health official or ambulance, who patrols the world in search of ill people. Once coming in contact with an infected individual, the ambulance immediately delivers the infected to the hospital within the region of residence.

The graph INFECTION AND RECOVERY RATES shows the rate of change of the cumulative infected and recovered in the population. It tracks the average number of secondary infections and recoveries per tick. The reproduction number is calculated under different assumptions than those of the KM model, as we allow for more than one infected individual in the population, and introduce aforementioned variables.

At the end of the simulation, the R0 reflects the estimate of the reproduction number, the final size relation that indicates whether there will be (or there was, in the model sense) an epidemic. This again closely follows the mathematical derivation that R0 = betaS(0)/ gamma = Nln(S(0) / S(t)) / (N - S(t)), where N is the total population, S(0) is the initial number of susceptibles, and S(t) is the total number of susceptibles at time t. In this model, the R_0 estimate is the number of secondary infections that arise for an average infected individual over the course of the person's infected period.

HOW TO USE IT

The SETUP button creates individuals according to the parameter values chosen by the user. Each individual has a 5% chance of being initialized as infected. Once the simulation has been setup, push the GO button to run the model. GO starts the simulation and runs it continuously until GO is pushed again.

Each time-step can be considered to be in hours, although any suitable time unit will do.

What follows is a summary of the sliders in the model.

INITIAL-PEOPLE (initialized to vary between 50 - 400): The total number of individuals the simulation begins with.
INFECTION-CHANCE (10 - 50): Probability of disease transmission from one individual to another. RECOVERY-CHANCE (10 - 100): Probability of an individual's recovery, after the average recovery tie has elapsed. AVERAGE-RECOVERY-TIME (50 - 300): Time it takes for an individual to recover, on average. The actual individual's recovery time is pulled from a normal distribution centered around the AVERAGE-RECOVERY-TIME at its mean, with a standard deviation of a quarter of the AVERAGE-RECOVERY-TIME. Each time-step can be considered to be in hours, although any suitable time unit will do.
AVERAGE-ISOLATION-TENDENCY (0 - 50): Average tendency of individuals to isolate themselves and will not spread the disease. Once an infected person is identified as an "isolator," the individual will isolate himself in the current location (as indicated by the grey patch) and will stay there until full recovery. AVERAGE-HOSPITAL-GOING-TENDENCY (0 - 50): Average tendency of individuals to go to a hospital when sick. If an infected person is identified as a "hospital goer," then he or she will go to the hospital, and will recover in half the time of an average recovery period, due to better medication and rest. INITIAL-AMBULANCE (0 - 4): Number of health officials or ambulances that move about at random, and force-quarantine sick individuals upon contact. The health officials are immune to the disease, and they themselves do not physically accompany the patient to the hospital. They move at a speed 5 times as fast as other individuals in the world and are not bounded by geographic region.
INOCULATION-CHANCE (0 - 50): Probability of an individual getting vaccinated, and hence immune from the virus.
INTRA-MOBILITY (0 - 1): This indicates how "mobile" an individual is. Usually, an individual at each time step moves by a distance 1. In this model, the person will move at a distance indicated by the INTRA-MOBILITY at each time-step. Thus, the lower the intra-mobility level, the less the movement in the individuals. Individuals move randomly by this assigned value; ambulances always move 5 times faster than this assigned value.

In addition, there are two switches, and a related slider:

LINKS? : When ON, there will be links randomly assigned between people, and the disease will spread twice as fast to those that the infected person is linked with as to the others. When OFF, the disease spreads with an equal chance to those around the infected person.
TRAVEL? : When ON, people from the two regions (separated by the yellow border in the middle) are allowed to migrate and mix. When OFF, the people stay in the region in which they live.
TRAVEL-TENDENCY (0 - 1): When TRAVEL? is ON, this slider indicates the probability of an individual to be traveling at each tick. The 1 indicates a 1 percent chance of travel per tick.

A number of graphs are also plotted in this model.

CUMULATIVE INFECTED AND RECOVERED: This plots the total percentage of individuals who have ever been infected or recovered.
POPULATIONS: This plots the number of people with or without the disease.
INFECTION AND RECOVERY RATES: This plots the estimated rates at which the disease is spreading. BetaN is the rate at which the cumulative infected changes, and Gamma rate at which the cumulative recovered changes.
R_0: This is an estimate of the reproduction number.

THINGS TO NOTICE

As with many epidemiological models, the number of people becoming infected over time, in the event of an epidemic, traces out an "S-curve." It is called an S-curve because it is shaped like a sideways S. By changing the values of the parameters using the slider, try to see what kinds of changes make the S curve stretch or shrink.

Whenever there's a spread of the disease that reaches most of the population, we say that there was an epidemic. The reproduction number serves as an indicator for the likeliness of an epidemic to occur, if it is greater than 1. If it is smaller than 1, then it is likely that the disease spread will stop short, and we call this an endemic.

Notice how the introduction of various human behaviors, such as travel, inoculation, isolation and quarantine, help constrain the spread of the disease, and what changes that brings to the population level in terms of rate and time taken of disease spread, as well as the population affected.

THINGS TO TRY

Compare this model with the epiDEM basic model. Do the added complexities significantly change the disease spread? What kinds of changes bring about interesting outcomes?

Notice the difference in dynamics when the travel chooser is on versus off. What happens to the population and the disease spread in both cases?

Does the disease spread change when the link chooser is on? What about when you increase the number of ambulances? What happens to the number of people infected?

Based on this model, what are some strategies or preventive measures that you think are important to undertake on the onset of a disease outbreak? Are there some that are more effective than others? Why might that be? What combinations work well? Are there some measures that seem redundant?

EXTENDING THE MODEL

Are there other ways to change the behavior of the people once they are infected? Try to think about how you would introduce such a variable.

In this model, we introduce an option for travel, so that there is mixing between two otherwise closed populations. What happens when you introduce births and deaths to each region or just one?

What would happen when the virus mutates? How will that change the population dynamic and disease spread?

What would happen if the population had a mix of healthy and less healthy people, so as to have differing levels of susceptibility?

NETLOGO FEATURES

Notice that each agent pulls from a truncated normal distribution, centered around the AVERAGE-RECOVERY-TIME set by the user, to determine its recovery-time. This is to account for the variation in genetic differences and the immune system functions of individuals. Similarly, an individual's isolation-tendency and hospital-going-tendency are pulled from truncated normal distributions centered around AVERAGE-ISOLATION-TENDENCY and AVERAGE-HOSPITAL-GOING-TENDENCY respectively.

Notice that R0 calculated in this model is a numerical estimate to the analytic R0. In the special case of one infective introduced to a wholly susceptible population (i.e., the Kermack-McKendrick assumptions), the numerical estimations of R0 are very close to the analytic values. With added complexity in the models, such as the introduction of travel and control measures, the analytic R0 becomes harder to derive. The numerical estimation is therefore a crude measure of what the actual R_0 might be.

In addition to travel and control measures, notice that this model introduces links amongst individuals and the individual's mobility, which also affect the dynamics of the disease transmission.

RELATED MODELS

epiDEM basic, AIDS, Virus and Virus on a Network are related models.

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

COPYRIGHT AND LICENSE

Copyright 2011 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

Comments and Questions

Click to Run Model

globals
[
  recovery-time       ;; Time (in hours) it takes to recover from the infection
  nbInfected-previous ;; Number of infected people at the previous tick
  border              ;; The patches representing the yellow border
  angle               ;; Heading for individuals
  betaN               ;; The average number of new secondary infections per infected this tick
  gamma               ;; The average number of new recoveries per infected this tick
  r0                  ;; The number of secondary infections that arise due to a single infective introduced in a wholly susceptible population
]

turtles-own
[
  infected?          ;; If true, the person is infected.
  cured?             ;; If true, the person has lived through an infection. They cannot be re-infected.
  inoculated?        ;; If true, the person has been inoculated.
  isolated?          ;; If true, the person is isolated, unable to infect anyone.
  hospitalized?      ;; If true, the person is hospitalized and will recovery in half the average-recovery-time.

  infection-length   ;; How long the person has been infected.
  isolation-tendency ;; Chance the person will self-quarantine during any hour being infected.
  hospital-going-tendency ;; Chance that an infected person will go to the hospital when infected

  continent          ;; Which continent a person lives one, people on continent 1 are squares, people on continent 2 are circles.

  ambulance?         ;; If true, the person is an ambulance and will transport infected people to the hospital.

  susceptible-0       ;; Tracks whether the person was initially susceptible
  nbInfected          ;; Number of secondary infections caused by an infected person at the end of the tick
  nbRecovered         ;; Number of recovered people at the end of the tick
]

;;;
;;; SETUP PROCEDURES
;;;

to setup
  clear-all
  setup-globals
  setup-people
  setup-ambulance
  reset-ticks
end 

to setup-globals
  ask patch (- max-pxcor / 2 ) 0 [ set pcolor white ]
  ask patch (max-pxcor / 2 ) 0 [ set pcolor white ]

  set border patches with [(pxcor =  0 and abs (pycor) >= 0)]
  ask border [ set pcolor yellow ]
end 

;; Create initial-people number of people.
;; Those that live on the left are squares; those on the right, circles.

to setup-people
  create-turtles initial-people
    [ setxy random-xcor random-ycor
      ifelse xcor <= 0
      [ set continent 1 ]
      [ set continent 2 ]

      set cured? false
      set isolated? false
      set hospitalized? false
      set ambulance? false
      set infected? false
      set susceptible-0 1

      assign-tendency

      ifelse continent = 1
        [ set shape "square" ]
        [ set shape "circle" ]

      set size 0.5

      ;; Each individual has a 5% chance of starting out infected
      if (random-float 100 < 5)
      [ set infected? true
        set susceptible-0 0
        set infection-length random recovery-time
      ]

      ifelse (not infected?) and (random-float 100 < inoculation-chance)
        [ set inoculated? true
          set susceptible-0 0 ]
        [ set inoculated? false ]

      assign-color
      ]

    if links? [ make-network ]
end 

to setup-ambulance
  create-turtles initial-ambulance
  [
    ifelse random 2 < 1
    [
      set continent 1
      setxy (- max-pxcor / 2) 0
    ]
    [
      set continent 2
      setxy (max-pxcor / 2) 0
    ]

    set cured? false
    set isolated? false
    set hospitalized? false
    set infected? false
    set inoculated? false

    set ambulance? true

    set shape "person"
    set color yellow
  ]
end 

to assign-tendency ;; Turtle procedure

  set isolation-tendency random-normal average-isolation-tendency average-isolation-tendency / 4
  set hospital-going-tendency random-normal average-hospital-going-tendency average-hospital-going-tendency / 4
  set recovery-time random-normal average-recovery-time average-recovery-time / 4

  ;; Make sure recovery-time lies between 0 and 2x average-recovery-time
  if recovery-time > average-recovery-time * 2 [ set recovery-time average-recovery-time * 2 ]
  if recovery-time < 0 [ set recovery-time 0 ]
  
  ;; Similarly for isolation and hospital going tendencies
  if isolation-tendency > average-isolation-tendency * 2 [ set isolation-tendency average-isolation-tendency * 2 ]
  if isolation-tendency < 0 [ set isolation-tendency 0 ]
  
  if hospital-going-tendency > average-hospital-going-tendency * 2 [ set hospital-going-tendency average-hospital-going-tendency * 2 ]
  if hospital-going-tendency < 0 [ set hospital-going-tendency 0 ]
end 


;; Different people are displayed in 5 different colors depending on health
;; green is a survivor of the infection
;; blue is a successful innoculation
;; red is an infected person
;; white is neither infected, innoculated, nor cured
;; yellow is an ambulance

to assign-color ;; turtle procedure

  ifelse cured?
    [ set color green ]
    [ ifelse inoculated?
      [ set color blue ]
      [ ifelse infected?
        [set color red ]
        [set color white]]]
  if ambulance?
    [ set color yellow ]
end 

to make-network
  ask turtles
  [
    create-links-with turtles-on neighbors
  ]
end 


;;;
;;; GO PROCEDURES
;;;

to go
  if all? turtles [ not infected? ]
    [ stop ]
  ask turtles
    [ clear-count ]

  ask turtles
    [ if not isolated? and not hospitalized? and not ambulance?
        [ move ] ]

  ask turtles
    [ if infected? and not isolated? and not hospitalized?
         [ infect ] ]

  ask turtles
    [ if not isolated? and not hospitalized? and infected? and (random 100 < isolation-tendency)
        [ isolate ] ]

  ask turtles
    [ if not isolated? and not hospitalized? and infected? and (random 100 < hospital-going-tendency)
        [ hospitalize ] ]

  ask turtles
  [
    if ambulance?
    [
      move
      ask turtles-on neighbors
      [
        if (ambulance? = false) and (infected? = true)
        [ hospitalize ]
      ]
    ]
  ]

  ask turtles
    [ if infected?
       [ maybe-recover ]
    ]

  ask turtles
    [ if (isolated? or hospitalized?) and cured?
        [ unisolate ] ]

  ask turtles
    [ assign-color
      calculate-r0 ]

  tick
end 

to move  ;; turtle procedure
  if travel?
  [
    if random 100 < (travel-tendency) and not ambulance?  ;; up to 1% chance of travel
    [ set xcor (- xcor) ]
  ]

  ifelse continent = 1
  [
    ifelse xcor > (- 0.5)  ;; and on border patch
    [
      set angle random-float 180
      let new-patch patch-at-heading-and-distance angle (-1)
      if new-patch != nobody
      [
        move-to new-patch
      ]
    ]
    [ ;; if in continent 1 and not on border
      ifelse xcor < (min-pxcor + 0.5)  ;; at the edge of world
      [
        set angle random-float 180
      ]
      [
        set angle random-float 360  ;; inside world
      ]
      rt angle

      ifelse ambulance?
      [
        fd intra-mobility * 5  ;; ambulances move 5 times as fast than the ppl
      ]
      [
        fd intra-mobility
      ]
    ]

  ]
  [ ;; in continent 2
    ifelse xcor < 1  ;; and on border patch
    [
      set angle random-float 180
      let new-patch patch-at-heading-and-distance angle (1)
      if new-patch != nobody
      [
        move-to new-patch
      ]
    ]
    [ ;; if in continent 2 and not on border
      ifelse xcor > (max-pxcor - 1) ;; at the edge of world
      [
        set angle random-float 180
      ]
      [
        set angle random-float 360
      ]
      lt angle

      ifelse ambulance?
      [
        fd intra-mobility * 5
      ]
      [
        fd intra-mobility
      ]
    ]

  ]
end 

to clear-count
  set nbInfected 0
  set nbRecovered 0
end 

to maybe-recover
  set infection-length infection-length + 1

      ;; If people have been infected for more than the recovery-time
      ;; then there is a chance for recovery
      ifelse not hospitalized?
      [
        if infection-length > recovery-time
        [
          if random-float 100 < recovery-chance
          [
            set infected? false
            set cured? true
            set nbRecovered (nbRecovered + 1)
          ]
        ]
      ]
      [ ;; If hospitalized, recover in a fifth of the recovery time
        if infection-length > (recovery-time / 5)
        [
          set infected? false
          set cured? true
          set nbRecovered (nbRecovered + 1 )
        ]
      ]
end 

;; To better show that isolation has occurred, the patch below the person turns gray

to isolate ;; turtle procedure
  set isolated? true
  move-to patch-here ;; move to center of patch
  ask (patch-at 0 0) [ set pcolor gray - 3 ]
end 

;; After unisolating, patch turns back to normal color

to unisolate  ;; turtle procedure
  set isolated? false
  set hospitalized? false

  ask (patch-at 0 0) [ set pcolor black ]

  ask border [ set pcolor yellow ]                      ;; patches on the border stay yellow
  ask (patch (- max-pxcor / 2) 0) [ set pcolor white ]  ;; hospital patch on the left stays white
  ask (patch (max-pxcor / 2) 0) [ set pcolor white ]    ;; hospital patch on the right stays white
end 

;; To hospitalize, move to hospital patch in the continent of current residence

to hospitalize ;; turtle procedure
  set hospitalized? true
  set pcolor black
  ifelse continent = 1
  [
    move-to patch (- max-pxcor / 2) 0
  ]
  [
    move-to patch (max-pxcor / 2) 0
  ]
  set pcolor white
end 

;; Infected individuals who are not isolated or hospitalized have a chance of transmitting their disease to their susceptible neighbors.
;; If the neighbor is linked, then the chance of disease transmission doubles.

to infect  ;; turtle procedure

    let caller self

    let nearby-uninfected (turtles-on neighbors)
    with [ not infected? and not cured? and not inoculated? ]
    if nearby-uninfected != nobody
    [
       ask nearby-uninfected
       [
           ifelse link-neighbor? caller
           [
             if random 100 < infection-chance * 2 ;; twice as likely to infect a linked person
             [
               set infected? true
               set nbInfected (nbInfected + 1)
             ]
           ]
           [
             if random 100 < infection-chance
             [
               set infected? true
               set nbInfected (nbInfected + 1)
             ]
           ]
       ]

    ]
end 

to calculate-r0

  let new-infected sum [ nbInfected ] of turtles
  let new-recovered sum [ nbRecovered ] of turtles
  set nbInfected-previous (count turtles with [ infected? ] + new-recovered - new-infected)  ;; Number of infected people at the previous tick
  let susceptible-t (initial-people - (count turtles with [ infected? ]) - (count turtles with [ cured? ]))  ;; Number of susceptibles now
  let s0 sum [ susceptible-0 ] of turtles  ;; Initial number of susceptibles

  ifelse nbInfected-previous < 10
  [ set betaN 0 ]
  [
    set betaN (new-infected / nbInfected-previous)       ;; This is the average number of new secondary infections per infected this tick
  ]

  ifelse nbInfected-previous < 5
  [ set gamma 0 ]
  [
    set gamma (new-recovered / nbInfected-previous)     ;; This is the average number of new recoveries per infected this tick
  ]

  if ((initial-people - susceptible-t) != 0 and (susceptible-t != 0))   ;; Prevent from dividing by 0
  [ set r0 (ln (s0 / susceptible-t) / (initial-people - susceptible-t)) ;; This is derived from integrating dI / dS = (beta*SI - gamma*I) / (-beta*SI)
    set r0 r0 * s0 ]                                                    ;; Assuming one infected individual introduced in the beginning, and hence counting I(0) as negligible,
end                                                                      ;; we get the relation
                                                                        ;; N - gamma*ln(S(0)) / beta = S(t) - gamma*ln(S(t)) / beta, where N is the initial 'susceptible' population.
                                                                        ;; Since N >> 1
                                                                        ;; Using this, we have R_0 = beta*N / gamma = N*ln(S(0)/S(t)) / (K-S(t))


; Copyright 2011 Uri Wilensky.
; See Info tab for full copyright and license.

There are 4 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky about 12 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky almost 13 years ago Updated from NetLogo 5.0 Download this version

Attached files

File Type Description Last updated
epiDEM Travel and Control.png preview Preview for 'epiDEM Travel and Control' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.