Age-Structured Disease Transmission Model with Interventions
Model was written in NetLogo 6.0.2
•
Viewed 13 times
•
Downloaded 5 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
;name agents breed [young_ones young_one] breed [young_adults young_adult] breed [middle_aged_adults middle_aged_adult] breed [seniors senior] ; variables that can be updated/changed as agents experience changes to themselves or the environment globals [ num-healthy num-infected num-recovered num-dead num-healthy-young-ones num-healthy-young-adults num-healthy-middle-aged-adults num-healthy-seniors num-infected-young-ones num-infected-young-adults num-infected-middle-aged-adults num-infected-seniors num-recovered-young-ones num-recovered-young-adults num-recovered-middle-aged-adults num-recovered-seniors num-dead-young-ones num-dead-young-adults num-dead-middle-aged-adults num-dead-seniors transmission-rate incubation-period symptomatic-period Log-data total-contact-rate contact-rate ] ; variable unique to each agents turtles-own [ healthy? infected? recovered? dead? susceptibility critical-illness-rate age-group days-infected days-since-symptoms daily-contacts vaccinated? wearing-mask? secondary-infections ; Note: variable to track secondary infections ] to setup clear-all ;assign values to relevant global variables set transmission-rate 0.0089 set incubation-period 122.4 set symptomatic-period 240 set Log-data [] set total-contact-rate 0 ; Note: let is used to create local variables that are used only within the current block of code. ; set number of agents as proportions of the total population let num-young-ones round (total-turtles * young-ones-proportion) let num-young-adults round (total-turtles * young-adults-proportion) let num-middle-aged-adults round (total-turtles * middle-aged-adults-proportion) let num-seniors round (total-turtles * seniors-proportion) ; create locations create-locations ; create agents, define name, set agent specific unique variables/properties create-turtles num-young-ones [ set breed young_ones set age-group "young ones" set-turtle-properties young-ones-susceptibility young-ones-vaccination-rate young-ones-masking-rate young-ones-contact-rate ] create-turtles num-young-adults [ set breed young_adults set age-group "young adults" set-turtle-properties young-adults-susceptibility young-adults-vaccination-rate young-adults-masking-rate young-adults-contact-rate ] create-turtles num-middle-aged-adults [ set breed middle_aged_adults set age-group "middle aged adults" set-turtle-properties middle-aged-adults-susceptibility middle-aged-adults-vaccination-rate middle-aged-adults-masking-rate middle-aged-adults-contact-rate ] create-turtles num-seniors [ set breed seniors set age-group "seniors" set-turtle-properties seniors-susceptibility seniors-vaccination-rate seniors-masking-rate seniors-contact-rate ] ;set number of intially infected repeat initial-infected [ ask one-of turtles with [not infected?] [ set infected? true set healthy? false set days-infected 0 set color red ] ] reset-ticks end ; assign the unique variables to agents (boolean, integer, float) to set-turtle-properties [initial-susceptibility vaccination-rate masking-rate initial-contact-rate] setxy random-xcor random-ycor set healthy? true set infected? false set recovered? false set dead? false set days-infected 0 set days-since-symptoms 0 set daily-contacts 0 set vaccinated? (random-float 1 < vaccination-rate) set wearing-mask? (random-float 1 < masking-rate) set susceptibility initial-susceptibility set contact-rate initial-contact-rate set secondary-infections 0 if vaccinated? [ set susceptibility susceptibility * (1 - vaccination-effectiveness) ; Adjust susceptibility based on vaccination effectiveness ] if age-group = "young ones" [ set critical-illness-rate 0.0004 set color yellow ] if age-group = "young adults" [ set critical-illness-rate 0.0029 set color blue ] if age-group = "middle aged adults" [ set critical-illness-rate 0.0039 set color green ] if age-group = "seniors" [ set critical-illness-rate 0.2 set color violet ] end to create-locations ask patches [ if random-float 1 < 0.1 [set pcolor blue] if random-float 1 < 0.05 [set pcolor yellow] if random-float 1 < 0.03 [set pcolor orange] if random-float 1 < 0.05 [set pcolor green] if random-float 1 < 0.04 [set pcolor magenta] if random-float 1 < 0.02 [set pcolor black] if random-float 1 < 0.03 [set pcolor white] ] end ; define movement pattern based on states and age group to move-to-location if infected? [ if days-infected >= incubation-period [ ifelse days-since-symptoms > 0 and days-since-symptoms <= symptomatic-period [ ifelse random 2 = 0 [ move-to one-of patches with [pcolor = magenta] ] [ move-to one-of patches with [pcolor = black] ] ] [ move-to one-of patches with [pcolor = magenta] ] ] ] if not infected? [ let current-hour ticks mod 24 let current-day (ticks / 24) mod 7 ifelse current-day < 5 [ if age-group = "young ones" [ if current-hour >= 8 and current-hour < 9 [move-to one-of patches with [pcolor = blue]] if current-hour >= 9 and current-hour < 15 [move-to one-of patches with [pcolor = orange]] if current-hour >= 15.5 and current-hour < 17 [move-to one-of patches with [pcolor = green]] if current-hour >= 17 and current-hour < 18 [move-to one-of patches with [pcolor = orange]] if current-hour >= 18 and current-hour < 19 [move-to one-of patches with [pcolor = blue]] if current-hour >= 19 and current-hour < 20 [move-to one-of patches with [pcolor = blue]] if current-hour >= 20 and current-hour < 21 [move-to one-of patches with [pcolor = blue]] ] if age-group = "young adults" [ if current-hour >= 7 and current-hour < 8 [move-to one-of patches with [pcolor = green]] if current-hour >= 8 and current-hour < 9 [move-to one-of patches with [pcolor = blue]] if current-hour >= 9 and current-hour < 17 [move-to one-of patches with [pcolor = yellow]] if current-hour >= 17.5 and current-hour < 18.5 [move-to one-of patches with [pcolor = green]] if current-hour >= 18.5 and current-hour < 19.5 [move-to one-of patches with [pcolor = blue]] if current-hour >= 19.5 and current-hour < 21 [move-to one-of patches with [pcolor = blue]] if current-hour >= 21 and current-hour < 22 [move-to one-of patches with [pcolor = blue]] ] if age-group = "middle aged adults" [ if current-hour >= 6 and current-hour < 7 [move-to one-of patches with [pcolor = green]] if current-hour >= 7 and current-hour < 8 [move-to one-of patches with [pcolor = blue]] if current-hour >= 8 and current-hour < 17 [move-to one-of patches with [pcolor = yellow]] if current-hour >= 17.5 and current-hour < 18.5 [move-to one-of patches with [pcolor = blue]] if current-hour >= 18.5 and current-hour < 19.5 [move-to one-of patches with [pcolor = blue]] if current-hour >= 19.5 and current-hour < 21 [move-to one-of patches with [pcolor = blue]] if current-hour >= 21 and current-hour < 22 [move-to one-of patches with [pcolor = blue]] ] if age-group = "seniors" [ if current-hour >= 7 and current-hour < 8 [move-to one-of patches with [pcolor = green]] if current-hour >= 8 and current-hour < 9 [move-to one-of patches with [pcolor = blue]] if current-hour >= 9 and current-hour < 12 [move-to one-of patches with [pcolor = yellow]] if current-hour >= 12 and current-hour < 13 [move-to one-of patches with [pcolor = blue]] if current-hour >= 13 and current-hour < 15 [move-to one-of patches with [pcolor = blue]] if current-hour >= 15 and current-hour < 17 [move-to one-of patches with [pcolor = blue]] if current-hour >= 17 and current-hour < 18 [move-to one-of patches with [pcolor = green]] if current-hour >= 18 and current-hour < 19 [move-to one-of patches with [pcolor = blue]] if current-hour >= 19 and current-hour < 21 [move-to one-of patches with [pcolor = blue]] ] if age-group = "elderly" [ if current-hour >= 8 and current-hour < 9 [move-to one-of patches with [pcolor = blue]] if current-hour >= 9 and current-hour < 11 [move-to one-of patches with [pcolor = green]] if current-hour >= 11 and current-hour < 13 [move-to one-of patches with [pcolor = blue]] if current-hour >= 13 and current-hour < 14 [move-to one-of patches with [pcolor = blue]] if current-hour >= 14 and current-hour < 16 [move-to one-of patches with [pcolor = white]] if current-hour >= 16 and current-hour < 18 [move-to one-of patches with [pcolor = blue]] if current-hour >= 18 and current-hour < 19 [move-to one-of patches with [pcolor = blue]] if current-hour >= 19 and current-hour < 21 [move-to one-of patches with [pcolor = blue]] ] ] [ if age-group = "young ones" [ if current-hour >= 8 and current-hour < 9 [move-to one-of patches with [pcolor = blue]] if current-hour >= 9 and current-hour < 11 [move-to one-of patches with [pcolor = green]] if current-hour >= 11 and current-hour < 12 [move-to one-of patches with [pcolor = blue]] if current-hour >= 12 and current-hour < 13 [move-to one-of patches with [pcolor = blue]] if current-hour >= 13 and current-hour < 15 [move-to one-of patches with [pcolor = green]] if current-hour >= 15 and current-hour < 17 [move-to one-of patches with [pcolor = green]] if current-hour >= 17 and current-hour < 18 [move-to one-of patches with [pcolor = blue]] if current-hour >= 18 and current-hour < 19 [move-to one-of patches with [pcolor = blue]] if current-hour >= 19 and current-hour < 20 [move-to one-of patches with [pcolor = blue]] if current-hour >= 20 and current-hour < 21 [move-to one-of patches with [pcolor = blue]] ] if age-group = "young adults" [ if current-hour >= 8 and current-hour < 9 [move-to one-of patches with [pcolor = blue]] if current-hour >= 9 and current-hour < 11 [move-to one-of patches with [pcolor = green]] if current-hour >= 11 and current-hour < 13 [move-to one-of patches with [pcolor = blue]] if current-hour >= 13 and current-hour < 15 [move-to one-of patches with [pcolor = white]] if current-hour >= 15 and current-hour < 17 [move-to one-of patches with [pcolor = green]] if current-hour >= 17 and current-hour < 18 [move-to one-of patches with [pcolor = blue]] if current-hour >= 18 and current-hour < 20 [move-to one-of patches with [pcolor = blue]] if current-hour >= 20 and current-hour < 22 [move-to one-of patches with [pcolor = white]] ] if age-group = "middle aged adults" [ if current-hour >= 7 and current-hour < 8 [move-to one-of patches with [pcolor = green]] if current-hour >= 8 and current-hour < 9 [move-to one-of patches with [pcolor = blue]] if current-hour >= 9 and current-hour < 17 [move-to one-of patches with [pcolor = yellow]] if current-hour >= 17.5 and current-hour < 18.5 [move-to one-of patches with [pcolor = blue]] if current-hour >= 18.5 and current-hour < 19.5 [move-to one-of patches with [pcolor = blue]] if current-hour >= 19.5 and current-hour < 21 [move-to one-of patches with [pcolor = blue]] if current-hour >= 21 and current-hour < 22 [move-to one-of patches with [pcolor = blue]] ] if age-group = "seniors" [ if current-hour >= 8 and current-hour < 9 [move-to one-of patches with [pcolor = blue]] if current-hour >= 9 and current-hour < 11 [move-to one-of patches with [pcolor = green]] if current-hour >= 11 and current-hour < 13 [move-to one-of patches with [pcolor = blue]] if current-hour >= 13 and current-hour < 14 [move-to one-of patches with [pcolor = blue]] if current-hour >= 14 and current-hour < 16 [move-to one-of patches with [pcolor = white]] if current-hour >= 16 and current-hour < 18 [move-to one-of patches with [pcolor = blue]] if current-hour >= 18 and current-hour < 19 [move-to one-of patches with [pcolor = blue]] if current-hour >= 19 and current-hour < 21 [move-to one-of patches with [pcolor = blue]] ] if age-group = "elderly" [ if current-hour >= 8 and current-hour < 9 [move-to one-of patches with [pcolor = blue]] if current-hour >= 9 and current-hour < 11 [move-to one-of patches with [pcolor = green]] if current-hour >= 11 and current-hour < 13 [move-to one-of patches with [pcolor = blue]] if current-hour >= 13 and current-hour < 14 [move-to one-of patches with [pcolor = blue]] if current-hour >= 14 and current-hour < 16 [move-to one-of patches with [pcolor = white]] if current-hour >= 16 and current-hour < 18 [move-to one-of patches with [pcolor = blue]] if current-hour >= 18 and current-hour < 19 [move-to one-of patches with [pcolor = blue]] if current-hour >= 19 and current-hour < 21 [move-to one-of patches with [pcolor = blue]] ] ] ] setxy random-xcor random-ycor end ; define general movement pattern and behaviours to go ask turtles [ if not dead? [ move-to-location infect-others develop-symptoms recover-or-die ] ] update-counts if num-infected = 0 [ calculate-R0 stop ] log-contact-rates tick end to calculate-R0 let total-secondary-infections sum [secondary-infections] of turtles with [infected? or recovered? or dead?] let total-infected count turtles with [infected? or recovered? or dead?] if total-infected > 0 [ let R0 total-secondary-infections / total-infected print (word "R0: " R0) ] end ; define how infected agents spread the disease to infect-others if infected? [ ;define infectious period let infectious-start incubation-period - 24 let infectious-end incubation-period + symptomatic-period + 72 ;check if within infected period and define infection radius if days-infected >= infectious-start and days-infected <= infectious-end [ let infection-radius 1 ;if practicing-social-distancing? [ ; set infection-radius 0.2 ; ] ;define set number and "condition" of likely to be infected let nearby-turtles turtles in-radius infection-radius with [not dead? and not infected?] ask n-of (count nearby-turtles * contact-rate) nearby-turtles [ let adjusted-transmission-rate transmission-rate if wearing-mask? [ set adjusted-transmission-rate transmission-rate * (1 - masking-effectiveness) ] ; if radom-float < adjusted-transmission-rate * susceptibility, get infected. if random-float 1 < adjusted-transmission-rate * susceptibility [ set infected? true set healthy? false set days-infected 0 set color red ask myself [set secondary-infections secondary-infections + 1] ] ; keep track of conatacts set daily-contacts daily-contacts + 1 ask myself [set daily-contacts daily-contacts + 1] ] ] ] end ; define when infections should start, it will indicate when infected agents should isolate themselves to develop-symptoms if infected? [ if days-infected = incubation-period [ set days-since-symptoms 0 ] set days-since-symptoms days-since-symptoms + 1 ] end ; define conditions for recovery or death to recover-or-die if infected? [ set days-infected days-infected + 1 if days-infected > incubation-period [ set days-since-symptoms days-since-symptoms + 1 ] if days-since-symptoms >= symptomatic-period [ if random-float 1 < critical-illness-rate [ ifelse random-float 1 < 0.5 [ set dead? true set infected? false set healthy? false set recovered? false set color black ] [ set recovered? true set infected? false set healthy? false set dead? false set color gray ] ] ;fail safe to ensure that all agents that didnt die, did recover. if not dead? [ set recovered? true set infected? false set healthy? false set dead? false set color gray ] ] ;recover after the symptomatic period has passed if days-infected > incubation-period + symptomatic-period [ set recovered? true set infected? false set healthy? false set dead? false set color gray ] ] end ;update counts to update-counts set num-healthy count turtles with [healthy?] set num-infected count turtles with [infected?] set num-recovered count turtles with [recovered?] set num-dead count turtles with [dead?] set num-healthy-young-ones count young_ones with [healthy?] set num-healthy-young-adults count young_adults with [healthy?] set num-healthy-middle-aged-adults count middle_aged_adults with [healthy?] set num-healthy-seniors count seniors with [healthy?] set num-infected-young-ones count young_ones with [infected?] set num-infected-young-adults count young_adults with [infected?] set num-infected-middle-aged-adults count middle_aged_adults with [infected?] set num-infected-seniors count seniors with [infected?] set num-recovered-young-ones count young_ones with [recovered?] set num-recovered-young-adults count young_adults with [recovered?] set num-recovered-middle-aged-adults count middle_aged_adults with [recovered?] set num-recovered-seniors count seniors with [recovered?] set num-dead-young-ones count young_ones with [dead?] set num-dead-young-adults count young_adults with [dead?] set num-dead-middle-aged-adults count middle_aged_adults with [dead?] set num-dead-seniors count seniors with [dead?] ;optional, can be replaced with output from behaviour space set Log-data lput (list ticks num-healthy num-infected num-recovered num-dead num-healthy-young-ones num-healthy-young-adults num-healthy-middle-aged-adults num-healthy-seniors num-infected-young-ones num-infected-young-adults num-infected-middle-aged-adults num-infected-seniors num-recovered-young-ones num-recovered-young-adults num-recovered-middle-aged-adults num-recovered-seniors num-dead-young-ones num-dead-young-adults num-dead-middle-aged-adults num-dead-seniors) Log-data end to log-contact-rates let total-contacts sum [daily-contacts] of turtles set total-contact-rate total-contacts ask turtles [set daily-contacts 0] end
There is only one version of this model, created about 8 hours ago by Chinemerem Okpara.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Age-Structured Disease Transmission Model with Interventions.png | preview | Preview for 'Age-Structured Disease Transmission Model with Interventions' | about 8 hours ago, by Chinemerem Okpara | Download |
This model does not have any ancestors.
This model does not have any descendants.