SIR Model - COVID19
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
;;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 5 years ago by Paul Smaldino.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
SIR Model - COVID19.png | preview | Preview for 'SIR Model - COVID19' | over 5 years ago, by Paul Smaldino | Download |
This model does not have any ancestors.
This model does not have any descendants.