# Infectious disease outbreak-vaccination vs. masking

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)

## WHAT IS IT?

This model allows students to compare the effects of vaccination and masking on the max daily cases and epidemic duration in a population. Both human beings and viruses are represented in the model.

## HOW IT WORKS

Susceptible-infectious-recovered (SIR) model is used to build the present model.

The model starts with a population of susceptible people (green) and one infectious person (orange). The infectious person carries the virus strain with a transmission rate defined by the transmission-rate slide.

In each tick, each unmasked infectious person produces a new virus with the same transmission rate. We assume no mutation in this model. The masked infectious person produces a new virus at a 50% of chance (i.e., the mask may prevent them from releasing the same amount of viruses to the environment).

The new virus may float 0.5 steps in a random direction and infect one of susceptible people within a radius of 1.5 at its transmission rate. The virus loses its ability to infect people if no susceptible people are within the infection radius.

Infectious people remain contagious for six days. They either recover (become blue) or die at a mortality rate of 10%. No new people join this model.

Users may set up the percentage of masking in the population. The masked infectious people release 50% less viable viruses than unmasked infectious people. The transmission rate of a virus decreases by 50% when infecting a masked susceptible person (i.e., 70% become 35%, 50% become 25%, and so on).

Users may set up the percentage of vaccinated people in the population. The present model assumes the vaccinated people will not be infected. However, the vaccinated people may get a breakthrough infection at a low chance when viruses mutate.

## HOW TO USE IT

First, choose the factors, such as population size, transmission rate, etc.

Click on

**Set up/Reset**, then**Run/Pause**. The model is set to stop when there are no infectious people.Observe the infection changes in the population in the plot and monitor.

Use

**Run one day**to run the model in a controlled way and collect day-by-day data.

## THINGS TO TRY

Collect the data of the max daily cases and epidemic duration to examine the effects of vaccination rates and % of masking.

## RELATED MODELS

Find this model series at http://3dsciencemodeling.com

- Infectious Disease Outbreak-Basic Phenomenon
- Infectious Disease Outbreak-Transmission and mortality
- Infectious Disease Outbreak-Population Comparison
- Infectious Disease Outbreak-HealthCare, Isolation and Quarantine
- Infectious Disease Outbreak-Social distancing
- Infectious Disease Outbreak-Vaccination
- Infectious Disease Outbreak-SEIR model
- Infectious Disease Outbreak-variants

## CREDITS AND REFERENCES

Dr. Lin Xiang (lin.xiang@uky.edu) created this model at the University of Kentucky in 2023. If you mention this model in a publication, we ask that you include the citations below.

Xiang, L. (2023). Infectious Disease Outbreak-vaccination and masking. Department of STEM Education, University of Kentucky, Lexington, KY.

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/.

Science Brief: Community Use of Masks to Control the Spread of SARS-CoV-2 https://www.cdc.gov/coronavirus/2019-ncov/science/science-briefs/masking-science-sars-cov2.html

## Comments and Questions

breed [persons person] breed [viruses virus] persons-own [infectious-period p-contagious susceptible infectious immunity vaccination] viruses-own [infection infection-period] Patches-own [ ] Globals [max-daily-cases breakthrough] ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Setup procedures ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;; to setup clear-all set-default-shape viruses "c-virus-0" set-patches setup-people add-an-infectious ;color-code reset-ticks end to set-patches ask patches [set pcolor 9 + random-float 1] end to setup-people let masking (population * %-of-masking / 100) ask n-of masking patches [ sprout-persons 1 [set size 0.9 set color 56 set shape "person-1" set susceptible true set infectious false set immunity 0 set infectious-period 0 set vaccination false ] ] ask n-of (population - masking) patches [ sprout-persons 1 [set size 0.9 set color 56 set shape "person-0" set susceptible true set infectious false set immunity 0 set infectious-period 0 set vaccination false ] ] let vaccinated (population * Vaccination-rate / 100) ask n-of vaccinated persons with [susceptible = true and infectious = false] [set susceptible false set infectious false set immunity Transmission-Rate set p-contagious Transmission-Rate set vaccination true set color 97] end to add-an-infectious ask one-of persons [set color 27 set susceptible false set infectious true set p-contagious Transmission-Rate hatch-viruses 1 [ set size 0.5 set infection Transmission-Rate set color 35 ;set-v-color ]] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Go procedures ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;; to go if ticks > 0 and not any? persons with [susceptible = false and infectious = true] [stop] move produce-viruses infect virus-ability recover ;color-code find-max-daily-cases ;plot-levels tick end to move ask viruses [right random 360 forward 0.5] end to produce-viruses ask persons with [susceptible = false and infectious = true] ;ask infectious people [ifelse shape = "person-1" ;if masking [if random 100 < 50 ;at a chance of 50% [hatch-viruses 1 [ ;produce a new virus set size 0.5 ;set the size of a virus set infection [p-contagious] of myself ;not mutate set color 35 ;set-v-color] ;set virus color based on infection rate ]]] [hatch-viruses 1 [ ;if no masking, always produce a new virus set size 0.5 ;set the size of a virus set infection [p-contagious] of myself ;not mutate set color 35 ;set-v-color]] ;set virus color based on infection rate ]]] end to infect ask viruses [if any? persons with [infectious = false] in-radius 1.5 [let infected-person one-of persons with [infectious = false] in-radius 1.5 (ifelse [immunity] of infected-person > 0 and [shape] of infected-person = "person-1" ;mutation lead to breakthough infection to a masked person, [if random 1000 < (0.05 * abs (infection - [immunity] of infected-person)) ;cut down 50% infection rate [move-to infected-person ask infected-person [set color 27 set susceptible false set infectious true set p-contagious [infection] of myself set immunity [infection] of myself ;update immunity ] set breakthrough breakthrough + 1 die]] ;ask virus to die after infecting a person [immunity] of infected-person > 0 and [shape] of infected-person = "person-0" ;mutation lead to breakthough infection to an unmasked person, [if random 1000 < (0.1 * abs (infection - [immunity] of infected-person)) ;cut down 50% infection rate [move-to infected-person ask infected-person [set color 27 set susceptible false set infectious true set p-contagious [infection] of myself set immunity [infection] of myself ;update immunity ] set breakthrough breakthrough + 1 die]] ;ask virus to die after infecting a person [immunity] of infected-person = 0 and [shape] of infected-person = "person-1" ;first infection to a masked person, [if random 100 < infection * 0.5 ;cut down 50% infection rate [move-to infected-person ask infected-person [set color 27 set susceptible false set infectious true set p-contagious [infection] of myself set immunity [infection] of myself ;update immunity ] die]] ;ask virus to die after infecting a person [immunity] of infected-person = 0 and [shape] of infected-person = "person-0" ;first infection to an unmasked person, [if random 100 < infection [move-to infected-person ask infected-person [set color 27 set susceptible false set infectious true set p-contagious [infection] of myself set immunity [infection] of myself ;update immunity ] die]]) ;ask virus to die after infecting a person ]] end to virus-ability ask viruses [ifelse infection-period >= 2 [die][set infection-period infection-period + 1]] end to recover ask persons with [susceptible = false and infectious = true] [ifelse infectious-period >= 7 [ifelse random 100 < 10 [die] [set color 97 set susceptible false set infectious false set infectious-period 0]] ;mortality equals 10% [set infectious-period infectious-period + 1] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; supporting procedures ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;; to set-v-color ; set colors of viruses (ifelse infection >= 80 [set color 15] infection < 80 and infection >= 60 [set color 127] infection < 60 and infection >= 40 [set color 117] infection < 40 and infection >= 20 [set color 35] infection < 20 [set color 75]) end to plot-levels ;; this creates creates the bar graph set-current-plot "People infected by variants with different transmissibilities" clear-plot plot-pen-down set-current-plot-pen "< 20%" plotxy 0 count persons with [p-contagious < 20 and p-contagious > 0] set-current-plot-pen "20%~39%" plotxy 1 count persons with [p-contagious < 40 and p-contagious >= 20] set-current-plot-pen "40%~59%" plotxy 2 count persons with [p-contagious < 60 and p-contagious >= 40] set-current-plot-pen "60%~79%" plotxy 3 count persons with [p-contagious < 80 and p-contagious >= 60] set-current-plot-pen ">= 80%" plotxy 4 count persons with [p-contagious >= 80] end to set-p-color ; set colors of people ask persons [ (ifelse p-contagious >= 80 and vaccination = false [set color 15] p-contagious < 80 and p-contagious >= 60 and vaccination = false [set color 127.5] p-contagious < 60 and p-contagious >= 40 and vaccination = false [set color 117.5] p-contagious < 40 and p-contagious >= 20 and vaccination = false [set color 36] p-contagious < 20 and p-contagious > 0 and vaccination = false [set color 75] p-contagious = 0 [set color 7] )] end to set-SIR-color ask persons [ (ifelse susceptible = true and infectious = false [set color 56] susceptible = false and infectious = true [set color 27] susceptible = false and infectious = false [set color 97] susceptible = true and infectious = true [set color 0])] end ;to color-code ;(ifelse ; Color-coding-modes = "Susceptible-infectious-recovered" [set-SIR-color] ; Color-coding-modes = "Variant transmission rates" [set-p-color]) ;end to find-max-daily-cases if count persons with [susceptible = false and infectious = true] > max-daily-cases ;Count the infectious.If it is greater than the current record of max daily cases [set max-daily-cases count persons with [susceptible = false and infectious = true]] ;update the max daily case end

There are 2 versions of this model.

This model does not have any ancestors.

This model does not have any descendants.