Covid-19 virus - effects of various measures used to contain its spread

Covid-19 virus - effects of various measures used to contain its spread preview image

1 collaborator

Rng_avatar Ronald Paul Ng (Author)

Tags

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.2 • Viewed 695 times • Downloaded 32 times • Run 0 times
Download the 'Covid-19 virus - effects of various measures used to contain its spread' 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 designed to simulate the spread of the virus Covid-19, using what is known regarding some aspects of the virus, and how the usual methods of containment might affect the outcome. It doesn’t include having vaccination of the population as one of the measures. It is based on the what is known of the virus as of early March, 2020.

[Report of the WHO-China Joint Mission on Coronavirus Disease 2019 (COVID-19), https://www.who.int/docs/default-source/coronaviruse/who-china-joint-mission-on-covid-19-final-report.pdf]

HOW IT WORKS

The number of people is selected together with the size of the world. The latter is not important, it is just for visual reasons. If too many agents are selected, and the size is small, it might be difficult to see the agents separately and follow them.

The population is maintained at a near constant level by birth.

The people could be in either 1 of five status: healthy (colored green), contact-health (colored pink), contact-infected (colored magenta) sick (colored yellow), and immune (colored gray).

In the absence of a vaccine, the ways governments tend to try and contain the virus is by isolating the sick, and identifying contacts of the sick or anyone tested positive for the virus. However, there might be delay in the identification of contacts and on how efficient is that method. As human beings live in groups and have connections, some having more connections than other, forming networks, on setting up the program to run, one of the settings is gamma. Gamma determines the number of links the individuals have, and the distribution of the number of links is in the form of power log. The formula that is used in determining how may link an agent has is in the form p(K) = K^(-γ) where γ is the Greek alphabet for gamma

HOW TO USE IT

Each "tick" represents a day .

NUMBER OF PEOPLE AND SIZE OF THE WORLD

These are the numbers that should first be initialized.

GAMMA

There determines the number of links which an agent might have. Based on the formula for power log distribution

CHANCE-INFECTION

After a healthy person has come into contact with an infected person via the link, this slider sets the chance of the healthy person being infected. We do not have data regarding the chance of infection, so varying the chance might show how critical is this parameter in the epidemiology of the spread of the virus.

CHANCE-RECOVER

At the moment, it seems the mortality rate is around 2% - 3%. But we are not sure, as many who are carrying the virus but are not sick would not appear in that statistics. So again, the slider would allow one to change the chance of recovery and to observe the results.

The duration of sickness on average is 14 days, but can be as long as 42 days. How long an agent has been sick is tracked by the turtle-own variable “sick-time”. At every tick, that number is compared with a random-exponential number with mean of 14, and if it is greater than that, a random number of between 0 and 99, inclusive, is then generated. And if that number is less than the “Chance-Recover”, it is cured, otherwise it dies.

DURATION OF INFECTION

From actual data, it seems the incubation period of the virus varies from an average of 5 – 6 days, to maximum of 14 days, during which time, it is possible for the infected person or agent, without appearing sick, to transmit the virus. Again , this parameter could be altered with the slider and the result observed.

IMMUNITY-DURATION-YR

After an agent has recovered, its status changes to “immune” and the duration of that immunity is dependent on the setting of the “immunity-duration-yr” slider.

CONTACT-TRACING

This slider controls how effective is the contact tracing, and hence how effective can the isolation process be implemented.

TO-QUARANTINE

This slider controls the number of days before a quarantine order is given, and will test the effect of any delays in quarantining contacts.

CONTACTS

Agents linked to an infected agent changes its status from "healthy" to either "contact-healthy" or "contact-infected". The chance of being "contact-infected" is determined by the slider chance-infected.

Once an agent changes its status to either "contact-healthy" or "contact-infected", depending on the "to-quarantine (delay in days)" slider and the "contact-tracing (efficiency)" slider, the agent might become quarantined or not. If the agent becomes quarantined, all the links with it will be broken, or in the language of NetLogo "die". So even though an agent might be "contact-infected" it is unable to infect any other agents as it has no links to anyone.

With each tick, the contact-time variable will increase and if an agent is "contact-healthy", after 14 ticks, it is returned to being "healthy" and links are reformed. If it is an agent which is "contact-infected", depending on the duration-infected sliked, it might become sick.

THINGS TO NOTICE

The factors controlled by the three sliders interact to influence how likely the virus is to thrive in this population. Notice that in all cases, these factors must create a balance in which an adequate number of potential hosts remain available to the virus and in which the virus can adequately access those hosts.

Often there will initially be an explosion of infection since no one in the population is immune. This approximates the initial "outbreak" of a viral infection in a population, one that often has devastating consequences for the humans concerned. Soon, however, the virus becomes less common as the population dynamics change. What ultimately happens to the virus is determined by the factors controlled by the sliders.

Notice that viruses that are too successful at first (infecting almost everyone) may not survive in the long term. Since everyone infected generally dies or becomes immune as a result, the potential number of hosts is often limited. The exception to the above is when the DURATION slider is set so high that population turnover (reproduction) can keep up and provide new hosts.

THINGS TO TRY

Try modiFying the density at different size of the world. What about chaing the effectiveness of contact tracing or the time it takes to quarantine an infected person. Chance of catching the virus?

EXTENDING THE MODEL

Allowing immigration, with an occasional sick person coming in. How will that affect the outcome?

Arrival of a vaccine?

Another point to notice is what would happen if the maximum number of links are imposed. This would simulate the government policy of limiting the group size of people meeting up

RELATED MODEL

Ronald Ng - Mt Elizabeth Medical Center, Singapore. e-mail: ronaldpaul.ng@gmail.com

Comments and Questions

Very good model (Question)

Thanks for sharing the very good model. I too have developed a model pretty much along the same lines. Hoping to upload the model soon. A question I have is that in the plot you have shown the X-axis in 'weeks'. Whereas your 'tick' appears to be based on days. So how did you convert the day count to week count? Thanks!

Posted over 5 years ago

Click to Run Model

turtles-own
  [ status               ;; either: healthy, contact-infected, contact-healthy, sick or immune ;;
    infectious-time      ;; after being infetious for 14 days, become sick
    remaining-immunity   ;; how many days of immunity the turtle has left
    contact-time         ;; how long since last contact
    sick-time            ;; this determines the point in time when the agent recovers
    age                  ;; how old is the turtle
    quarantined?         ;; whether the person is quarantined
    number-of-links      ;; number of links each turtle has
  ]

patches-own
  [
  ]

globals
  [ %infected            ;; what % of the population is infectious
    %immune              ;; what % of the population is immune
    maximum-population   ;; keep it the same as the number of people who started.
    lifespan             ;; the lifespan of a turtle
    initial-ave-links    ;; initial average number of links
    immunity-duration    ;; turtle being immune in number of days
    total-died           ;; total number of people died from the virus
    total-sick           ;; total number of people who became sick
    max-sick             ;; the highest number at one time hospitalised
    number-sick          ;; number of sick people at any one moment
    number-infected      ;; number of infeccted people but not sick at any one moment, ie contact-infected status
    max-number-sick-at-one-time ;; the maximum sick at any one moemnt, hence the max in hospital
  ]

to setup
  clear-all
  resize-world 0 (size-of-world - 1) 0 (size-of-world - 1)
  set-patch-size (500 / max-pxcor)
  set maximum-population number-people  ;; this is to keep the total populace constant even though some will die
  ;; ==================================================

  set lifespan 80 * 365.25  ;; life expectancy set to 80

  set immunity-duration immunity-duration-yr * 365  ;; remain immune for number of years in days as indicated by immunity-duration-yr
  set max-number-sick-at-one-time 0
  set total-died 0
  ;; ===================================================
  create-turtles number-people
    [ set status "healthy"
      set age random lifespan
      set color green
      set sick-time 0
      set contact-time 0
      set remaining-immunity 0
      set size 1.5  ;; easier to see
      set quarantined? false
      setxy random-xcor random-ycor
    ]

;; code for number of links
  ask turtles [make-links]
  set initial-ave-links count links / count turtles
;;  =======================================================================
  ;; the next two line is to get the mean of number-of-links of turtles with high number of links
;  let max-links-turtles max-n-of 1000 turtles [number-of-links]
;  show mean [number-of-links] of max-links-turtles
;;  ========================================================================
  ask n-of initial-infectious-number turtles
    [ set status "contact-infected"
      set infectious-time 1
      set color magenta
    ]

  reset-ticks

  if hide-links? = true [ask links [hide-link]]
end 

to go
  ask turtles [
    get-older ;; everybody gets older
    if status = "healthy" [
                           reproduce ;; this is to keep population number constant when peole dies
                          ]
    if status = "contact-healthy" and quarantined? = true [set contact-time contact-time + 1
                                                           if contact-time > 14 [ set status "healthy"
                                                                                  set quarantined? false  ;; since he is healthy, can be released from quarantine
                                                                                  make-links              ;; after 14 days, and shown to be not sick, can form links agai.
                                                                                  set color green
                                                                                  set contact-time 0]
                                                          ]
    ;; if a contact has not been qurantined, depending on the efficiency in contact tracing and the delay (as measured by contact-time) in qurantine
    ;; he might be or might not be quarantine. that is determined by a raondom number.
    if status = "contact-healthy" and quarantined? = false [set contact-time contact-time + 1
                                                            if contact-time >= to-quarantine [ if random 100 < contact-tracing [getting-quarantine]]
                                                            if contact-time > 14 [ set status "healthy"
                                                                                  set color green
                                                                                  ;; no need to make links as links are still intact since it is not quarantined
                                                                                  set contact-time 0]
                                                           ]

    if status = "contact-infected" and quarantined? = true [set infectious-time infectious-time + 1
                                                            if infectious-time > random 14 [ set status "sick"             ;; if infectious-time > max incubation time of 14, but can be shorter
                                                                                             set color yellow
                                                                                             ask [my-links] of self [die]  ;; hospitalised, no longer have links to infect
                                                                                             set total-sick total-sick + 1
                                                                                             set sick-time sick-time + 1
                                                                                           ]

                                                           ]

    if status = "contact-infected" and quarantined? = false [infect              ;; these are the agents who were not quarantined, though infectious.
                                                             set infectious-time infectious-time + 1
                                                             set contact-time contact-time + 1
                                                             if contact-time >= to-quarantine [if random 100 < contact-tracing [getting-quarantine]]
                                                             if infectious-time > random 14 [ set status "sick"             ;; if infectious-time > max incubation time of 14, but can be shorter
                                                                                             set color yellow
                                                                                             ask [my-links] of self [die]  ;; hospitalised, no longer have links to infect
                                                                                             set total-sick total-sick + 1
                                                                                             set sick-time sick-time + 1
                                                                                            ]

                                                           ]


    if status = "sick" [ infect  ;; this line of code comes before severing links, as he might infect other first before identified and go to hospital
                                 ;; if links are cut already in the previous round, he won't be able to infect others. (See procedure on "to infect"
                         set sick-time sick-time + 1
                         ask [my-links] of self [die]  ;; with links severed, it cannot infect anyone - equivalent of going to hospital
                         if sick-time > random-exponential 14 [recover-or-die]  ;; average sick time is 14 days, beween 6 to  42 days.
                       ]

    if status = "immune" [set color grey
                          ask [my-links] of self [die]
                          set remaining-immunity remaining-immunity - 1
                          if remaining-immunity <= 0 [get-healthy] ;; no longer immune, and becomes like normal
                         ]
  ]
  set number-sick count turtles with [status = "sick"] ;; this show the number sick at any ONE time
  set %infected (count turtles with [status = "sick"] + count turtles with [status = "contact-infected"]) / count turtles * 100
  set %immune  count turtles with [status = "immune"] / count turtles * 100
    if number-sick > max-number-sick-at-one-time [set max-number-sick-at-one-time number-sick]
  if count turtles with [status = "sick"] + count turtles with [status = "contact-infected"] = 0 [stop]
  tick
end 

to get-older
  set age age + 1
end 

to make-links
  ifelse max-number-of-links = 0
      [let K exp(ln(random-float 1) / (- gamma))
                  if K > count turtles with [quarantined? = false] [ set K count turtles with [quarantined? = false] - 1] ;; only those not with quarantined? = true can form links
                  set K round K
                  create-links-with n-of K other turtles
                  set number-of-links K]
       [let K exp(ln(random-float 1) / (- gamma))
                  if K > max-number-of-links [ set K max-number-of-links] ;; this will set the upper limit of links
                  set K round K
                  create-links-with n-of K other turtles
                  set number-of-links K]
end 

to reproduce
  if count turtles < number-people [hatch (number-people - count turtles) [set status "healthy"
                                                                           set age random lifespan
                                                                           set sick-time 0
                                                                           set remaining-immunity 0
                                                                           set size 1.5  ;; easier to see
                                                                           set quarantined? false
                                                                           make-links
                                                                           setxy random-xcor random-ycor]
                                    ]
end 

to infect
  ask link-neighbors [ifelse random 100 <= chance-infected [set status "contact-infected"
                                                           set color magenta
                                                           set contact-time 1]  ;; contact time is set as marker for when he is detected to be a contact
                                                          [set status "contact-healthy"
                                                           set color pink - 3
                                                           set contact-time 1 ]  ;; contact time is set as market for when he is detected to be a contact
                     ]
end 

to getting-quarantine
  set quarantined? true
  ask [my-links] of self [die] ;; once the agentis quarantined, he is not linked to anyone
end 

to recover-or-die
  ifelse random 100 > chance-recover [set total-died total-died + 1
                                      die
  print total-died]
                                     [set status "immune"
                                      set color grey
                                      set sick-time 0
                                      set contact-time 0
                                      set quarantined? false
                                      set remaining-immunity immunity-duration-yr * 365.25
                                     ]
end 

to get-healthy
  set status "healthy"
  set color green
  set sick-time 0
  set contact-time 0
  set remaining-immunity 0
  set quarantined? false
  make-links
end 

There is only one version of this model, created over 5 years ago by Ronald Paul Ng.

Attached files

File Type Description Last updated
Covid-19 virus - effects of various measures used to contain its spread.png preview Preview for 'Covid-19 virus - effects of various measures used to contain its spread' over 5 years ago, by Ronald Paul Ng Download

This model does not have any ancestors.

This model does not have any descendants.