Minimal SIS

Minimal SIS preview image

1 collaborator

Default-person Zebedee Mason (Author)

Tags

covid-19 

Tagged by Zebedee Mason about 10 hours ago

epidemiology 

Tagged by Zebedee Mason about 10 hours ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.4.0 • Viewed 20 times • Downloaded 0 times • Run 0 times
Download the 'Minimal SIS' 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?

The Minimal SIS model is a discrete stochastic compartmental model of an epidemic that averages to the (ordinary differential equation) SIS model. Each individual within a population is in one of two states known, in epidemic modelling, as compartments:

  • S - Susceptible to infection.
  • I - Infected and infectious.

HOW IT WORKS

Setup

There are sliders to vary:

  • The size of the population that will be divided into compartments.
  • The basic reproduction number.

The basic reproduction number, R0, is defined as the number of individuals that will be infected by one individual in an otherwise susceptible population.

Go

Initially one individual is infected. At each step the simulation proceeds by each infected individual selecting R0 others at random and irrespective of their state - the model is said to be "well mixed". At the end of the step the infected become susceptible and those susceptible that were selected become infected. The simulation finishes when there are no longer any infected, which is probably never.

As the simulation progresses lines are drawn between the previous generation of infected and those individuals that they were in contact with. The colour of the individuals changes according to the code:

  • Susceptible - Blue.
  • Infected - Red.

There are two plots of how the statistics vary as the iterations proceed. The first shows how the individuals are divided between the two compartments. The second how the reproduction number varies between zero and R0.

HOW TO USE IT

Move the sliders then press setup. Perform a simulation and note how the epidemic curves vary.

THINGS TO NOTICE

Variation of the reproduction number

If this were constant then the epidemic would be growing exponentially. The initial step plots a value of R0 which matches its definition.

If this were the SIS model instead then it would be the smooth function R0 x S / N where S is the number of susceptible and N = S + I is the size of the population.

Selecting R0 others

Each infected picking the number of susceptible is equivalent to sampling (without replacement) R0 individuals from a hypergeometric probability distribution.

THINGS TO TRY

EXTENDING THE MODEL

Minimal SIR model

Check out the Minimal SIR model for a three compartment model.

CREDITS AND REFERENCES

This software implementation was forked from

Copyright 2003 Uri Wilensky.

HOW TO CITE

If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

  • Mason, Z. W. T. (2025). The minimal SIR model, validated then extended to social networks and stochastic differential equations. https://osf.io/y6ckv/. Stoch Answers Ltd, Sheffield, UK.

Please cite the NetLogo software as:

COPYRIGHT AND LICENSE

Copyright 2025 Zebedee Mason

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 https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

extensions [array]
globals [reproduction-number old-infected new-infected]

breed [individuals individual]
individuals-own [
  state                   ;; my current state: "INFECTED", or "SUSCEPTIBLE"

  marked?                 ;; whether I'm currently marked

]

to setup
  clear-all
  ;; set up the model

  make-turtles
  set reproduction-number basic-reproduction-number
  set new-infected 1
  recolor
  reset-ticks
end 

;; create all the turtles, place them, and associate forks with individuals


to make-turtles
  set-default-shape individuals "person torso"
  ;; create-ordered- equally spaces the headings of the turtles,

  ;; in who number order

  create-ordered-individuals population [
    set size 0.1
    jump 0.35
    set state "SUSCEPTIBLE"
    set marked? false
  ]
  ask individual 0 [set state "INFECTED"]
end 

to go
  if new-infected > 0
  [
    a-go
  ]
end 

to a-go
  set old-infected new-infected
  clear-links
  ask individuals [ infect ]
  set new-infected 0
  ask individuals [ update ]
  ifelse old-infected = 0
  [
    set reproduction-number 0
  ]
  [
    set reproduction-number (new-infected / old-infected)
  ]
  recolor
  tick
end 

;; everybody gets a new color.


to recolor
  ask individuals [
    ;; look up the color in the colors list indexed by our current state

    ifelse state = "SUSCEPTIBLE"
      [ set color blue ]
      [ set color red ]
  ]
end 

;;


to infect  ;; individual procedure

  if state = "INFECTED" [
    ;; create an array of random numbers

    let values array:from-list shuffle range (population - 1)
    let index 0
    repeat basic-reproduction-number [
      let i2 array:item values index
      let i3 ((i2 + 1 + who) mod population)
      ask individual i3 [set marked? true]
      create-link-with individual i3
      set index (index + 1)
    ]
  ]
end 

;;


to update  ;; individual procedure

  ifelse marked? and state = "SUSCEPTIBLE"
  [
    set state "INFECTED"
    set new-infected (new-infected + 1)
  ]
  [
    if state = "INFECTED" [
      set state "SUSCEPTIBLE"
    ]
  ]
  set marked? false
end 


; Copyright 2025 Zebedee Mason.

; See Info tab for full copyright and license.

There is only one version of this model, created about 10 hours ago by Zebedee Mason.

Attached files

File Type Description Last updated
Minimal SIS.png preview Preview for 'Minimal SIS' about 10 hours ago, by Zebedee Mason Download

This model does not have any ancestors.

This model does not have any descendants.