To Mask or Not to Mask

To Mask or Not to Mask preview image

1 collaborator

Default-person David Knoke (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.3.0 • Viewed 154 times • Downloaded 17 times • Run 0 times
Download the 'To Mask or Not to Mask' 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?

ABM of Covid-19 spread in a political population of masked and unmasked agents. Source: Chapter 3 Infecting in David Knoke. 2025. Network Collective Action: Agent-Based Models of Pandemics, Riots, Social Movements, Insurrections and Insurgencies. Cham, Switzerland: Springer Nature.

HOW IT WORKS

Based on a June 2020 Gallup Poll, 56% of agents are Democrats, 44% are Republicans. Averaging Gallup and Pew Poll estimates. 50% of Republicans wear masks and 50% don't; 85% of Democrats wear masks and 15% don't. The Ns are 220, 220, 476, and 84. Color codes: Republican Masked (red), Republican Not Masked (pink), Democrat Masked (blue), Democrat Not Masked (cyan).

HOW TO USE IT

To exaggerate differential infectious rates between masked (repms, demms) and unmasked (repns, demns) agents, set initial sliders to 10% for masked, 90% for unmasked. Set removal rate low (2-3%)

THINGS TO NOTICE

Due entirely to differential mask-wearing between parties, more Democrats than Republicans remain uninfected when the pandemic ends.

THINGS TO TRY

Vary the Maked-Infectious, Unamsked-Infectious, and Removal-Rate. What happens when number of agents is reduced, i.e. greater physical distance as a proxy for social-distancing? (Keep the the four political groups proportional by aligning their slider locations)

EXTENDING THE MODEL

NETLOGO FEATURES

RELATED MODELS

Álvarez, Lindsay and Sergio Rojas-Galeano. 2020. "Simulation of Non-Pharmaceutical Interventions on COVID-19 with an Agent-Based Modal of Zonal Restraint." medRxiv 20130542

Brearcliffe, Dale. 2020. “Non-Pharmaceutical Herd Immunity Using Homemade Masks.” Paper presented to International Conference on Social Computing, Behavioral-Cultural Modeling & Prediction and Behavior Representation in Modeling and Simulation. October 20.

Kerr, Cliff C., Robyn M. Stuart, Dina Mistry et al. 2021. “Covasim: An Agent-Based Model of COVID-19 Dynamics and Interventions.” PLOS Computational Biology 17:e1009149.

Wilensky, Uri. 1998. “NetLogo Virus Model.” Evanston, IL: Northwestern University Center for Connected Learning and Computer-Based Modeling. http://ccl.northwestern.edu/netlogo/models/Virus

CREDITS AND REFERENCES

Gallup Poll. 2020. "Party Identification." https://news.gallup.com/poll/15370/party-affiliation.aspx

Pew Research Center. 2020. "Republicans, Democrats Move Even Further Apart in Coronavirus Concerns." https://www.pewresearch.org/politics/2020/06/25/republicans-democrats-move-even-further-apart-in-coronavirus-concerns/

Comments and Questions

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

Click to Run Model

;; To Mask or Not to Mask - NetLogo Code
;; David Knoke, University of Minnesota
;; May 30, 2023
;;
;; Use slider to set population size between 1,000 and 3,000 in increments of 500
;; Use sliders to set percents of population Republican & Democrat mask-wearers and unmasked
;; Based on Gallup and Pew Polls in June 2020:
;; Proportions of partisans:  Democrat = .56    Republican = .44
;; Proportions wearing masks: Democrat = .43    Republican = .23
;; Proportions not masked:    Democrat = .13    Republican = .21

breed [repms repm]
breed [repns repn]
breed [demms demm]
breed [demns demn]

globals [
  colors   ;; Republican Masked = red, Republican Not Masked = pink, Democrat Masked = blue, Democrat Not Masked = cyan
  initial-red    ;; How many turtles red at start?
  initial-blue   ;; How many turtles blue at start?
  initial-pink   ;; How many turtles pink at start?
  initial-cyan   ;; How many turtles cyan at start?
  infectedreps
  infecteddems
  ratiorepsdems
  infectedmaskedreps
  infectedmaskeddems
  infectedunmaskedreps
  infectedunmaskeddems
]

to setup
  clear-all
  ask patches [set pcolor white]    ;; Make all patches white

  create-repms ((Population_Size) * (%_Republicans_Masked / 100))  [  ;; create initial Number of Republicans Wearing Masks
    setxy random-xcor random-ycor
    set color red
    set shape "person"
    set size 2
  ]
  create-repns ((Population_Size) * (%_Republicans_Unmasked / 100))  [  ;; create initial Number of Republicans Not Wearing Masks
    setxy random-xcor random-ycor
    set color pink
    set shape "person"
    set size 2
  ]
  create-demms ((Population_Size) * (%_Democrats_Masked / 100))  [  ;; create initial Number of Democrats Wearing Masks
    setxy random-xcor random-ycor
    set color blue
    set shape "person"
    set size 2
  ]
  create-demns ((Population_Size) * (%_Democrats_Unmasked / 100))   [  ;; create initial Number of Democrats Not Wearing Masks
    setxy random-xcor random-ycor
    set color cyan
    set shape "person"
    set size 2
  ]
  ask n-of (Population_Size * .01) turtles [set color black    ;; Initial infected turtles are 1% of population
  ]
  ;;  Count how many turtles of each color at start
  set initial-red count turtles with [color = red]
  set initial-blue count turtles with [color = blue]
  set initial-pink count turtles with [color = pink]
  set initial-cyan count turtles with [color = cyan]
  reset-ticks
end 

to go
  ;; Stop the simulation when no turtles remain infected (black)
  if (count turtles with [color = black] = 0)
  [stop]
  move
  infect1
  infect2
  removal
  tally
  tick
end 

to move
  ;; Turtles move one patch in a randomly selected 360-degree direction; removed turtles do not move
  ask turtles with [color != green][
    right random 360
    forward 1
  ]
end 

to infect1
  ;; Republicans encountering an infected agent become infected if a random number is less than the infection rate for the masked or the unmasked
  ask turtles with [color = red] [
    if any? turtles-here with [color = black] and random 100 < Masked_Infectiousness [
      set color black]
  ask turtles with [color = pink] [
    if any? turtles-here with [color = black] and random 100 < Unmasked_Infectiousness [
      set color black]
    ]
  ]
end 

to infect2
  ;; Democrats encountering an infected agent become infected if a random number is less than the infection rate for masked or not masked
  ask turtles with [color = blue] [
    if any? turtles-here with [color = black] and random 100 < Masked_Infectiousness [
      set color black]
  ask turtles with [color = cyan] [
    if any? turtles-here with [color = black] and random 100 < Unmasked_Infectiousness [
      set color black]
    ]
  ]
end 

to removal
  ;; Infected persons (black) are removed (turn green & stop infecting others) if a random number from 1 to 100 is below the removal rate (1 to 10)
  ask turtles with [color = black] [
    if random 100 < Removal_Rate [
      set color green]
  ]
end 

to tally  ;; Percentages for BehaviorSpace, based on Population_Size
  set infectedreps (100 - (((count turtles  with [color = red]) + (count turtles with [color = pink])) / (initial-red + initial-pink) * 100))
  set infecteddems (100 - (((count turtles  with [color = blue]) + (count turtles with [color = cyan])) / (initial-blue + initial-cyan) * 100))
  ;; Add +1 to denominator to avoid division by zero:
  set ratiorepsdems (infectedreps / (infecteddems + 1))
  set infectedmaskedreps (100 - (count turtles with [color = red] / initial-red * 100))
  set infectedmaskeddems (100 - (count turtles with [color = blue] / initial-blue * 100))
  set infectedunmaskedreps (100 - (count turtles with [color = pink] / initial-pink * 100))
  set infectedunmaskeddems (100 - (count turtles with [color = cyan] / initial-cyan * 100))
end 

There is only one version of this model, created 3 months ago by David Knoke.

Attached files

File Type Description Last updated
To Mask or Not to Mask.png preview Preview for 'To Mask or Not to Mask' 3 months ago, by David Knoke Download

This model does not have any ancestors.

This model does not have any descendants.