SIR Model - COVID19
Model was written in NetLogo 6.1.1
•
Viewed 4498 times
•
Downloaded 104 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
;;SIR Model with random movement ;;Agents move around at random. ;;They are either Susceptible, Infected, or Recovered (or, equivalently, removed) ;; ;;Coded in 2020 by Paul Smaldino ;;http://smaldino.com/wp/ ;; ;;----------------------------------------- ;;CREATIVE COMMONS LICENSE ;;This code is distributed by Paul Smaldino under a Creative Commons License: ;;Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) ;;https://creativecommons.org/licenses/by-sa/4.0/ globals [max-infected] turtles-own[ infected? immune? ] to setup clear-all setup-turtles setup-infected set max-infected (count turtles with [infected?]) reset-ticks end to setup-turtles create-turtles num-turtles [ set color white set shape "person" set size 2 set infected? false set immune? false setxy random-pxcor random-pycor ] end to setup-infected ask n-of init-infected turtles [ set color red set infected? true ] end to go ;;stop if everyone or noone is infected if (count turtles with [infected?] = 0) or (count turtles with [infected?] = num-turtles) [stop] infect-susceptibles recover-infected recolor move calculate-max-infected tick end to infect-susceptibles ;; S -> I ask turtles [ let infected-neighbors (count other turtles with [color = red] in-radius 1) if (random-float 1 < 1 - (((1 - transmissibility) ^ infected-neighbors)) and not immune?) [set infected? true] ] end to recolor ask turtles with [infected?] [ set color red] end to move ask turtles [ right random 360 ;;get a new random heading forward speed ] end to recover-infected ;;I -> R ask turtles with [infected?] [ if random-float 1 < recovery-rate [ set infected? false ifelse remove-recovered? [ set immune? true set color gray ] [ set color white ] ] ] end to calculate-max-infected let x (count turtles with [infected?]) if x > max-infected [set max-infected x] end to-report max-infected-prop report max-infected / num-turtles end to-report prop-uninfected report (count turtles with [not infected? and not immune?]) / num-turtles end
There is only one version of this model, created over 4 years ago by Paul Smaldino.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
SIR Model - COVID19.png | preview | Preview for 'SIR Model - COVID19' | over 4 years ago, by Paul Smaldino | Download |
This model does not have any ancestors.
This model does not have any descendants.