Replication files for:
Boyer, C., Rumpler, E., Kissler, S., & Lipsitch, M. (2022). Epidemics, 40, 100620. https://doi.org/10.1016/j.epidem.2022.100620
Social gatherings can be an important locus of transmission for many pathogens including SARS-CoV-2. During an outbreak, restricting the size of these gatherings is one of several non-pharmaceutical interventions available to policy-makers to reduce transmission. Often these restrictions take the form of prohibitions on gatherings above a certain size. While it is generally agreed that such restrictions reduce contacts, the specific size threshold separating "allowed" from "prohibited" gatherings often does not have a clear scientific basis, which leads to dramatic differences in guidance across location and time. Building on the observation that gathering size distributions are often heavy-tailed, we develop a theoretical model of transmission during gatherings and their contribution to general disease dynamics. We find that a key, but often overlooked, determinant of the optimal threshold is the distribution of gathering sizes. Using data on pre-pandemic contact patterns from several sources as well as empirical estimates of transmission parameters for SARS-CoV-2, we apply our model to better understand the relationship between restriction threshold and reduction in cases. We find that, under reasonable transmission parameter ranges, restrictions may have to be set quite low to have any demonstrable effect on cases due to relative frequency of smaller gatherings. We compare our conceptual model with observed changes in reported contacts during lockdown in March of 2020.
├── __master_run.R # Main script to reproduce all results
├── 0_functions/ # Helper functions
│ ├── simulation_functions.R # Monte Carlo simulation functions
│ ├── plot_functions.R # Plotting utilities
│ └── alternative_model.R # Alternative modeling approaches
├── 1_data/ # Data sources
│ ├── BBC_Pandemic/ # BBC Pandemic study contact data
│ ├── COMIX/ # COMIX survey data
│ └── Sekara/ # Sekara et al. gathering size data
├── 2_code/ # Analysis scripts
│ ├── 0_packages.R # Required R packages
│ ├── 1_functions.R # Core mathematical functions
│ ├── 2_theory.R # Theoretical model implementation
│ ├── 3_empirical_distributions.R # Empirical data analysis
│ ├── 4_empirical_restrictions.R # Restriction effectiveness analysis
│ └── 5_tau_sensitivity.R # Sensitivity analysis
├── 3_results/ # Generated figures and results
└── 4_manuscript/ # LaTeX manuscript files
This code was developed and tested with R version 4.0+.
tidyverse- Data manipulation and visualizationmagrittr- Pipe operatorsggpubr- Publication-ready plotspoweRlaw- Power law distribution functionsreadxl- Excel file readingscales- Plot scaling functionsprogressr- Progress bars for long computationsfurrr- Parallel processing
Install all dependencies by running:
install.packages(c("tidyverse", "magrittr", "ggpubr", "poweRlaw",
"readxl", "scales", "progressr", "furrr"))To reproduce all main results, simply run:
source("__master_run.R")This will execute the complete analysis pipeline and generate all figures in the 3_results/ directory.
For more control over the analysis, you can run individual components:
-
Load packages and functions:
source("2_code/0_packages.R") source("2_code/1_functions.R")
-
Generate theoretical results (Figure 1):
source("2_code/2_theory.R") -
Analyze empirical distributions (Figures 3-4):
source("2_code/3_empirical_distributions.R") -
Evaluate restriction effectiveness (Figures 5-6):
source("2_code/4_empirical_restrictions.R") -
Run sensitivity analyses (Supplementary figures):
source("2_code/5_tau_sensitivity.R")
The core model calculates the expected number of secondary infections per gathering of size k:
E[X|K=k] = k × p_s × (1 - (1-τ)^(k×π))
Where:
- k = gathering size
- τ = transmission probability per contact
- π = proportion infectious in population
- p_s = proportion susceptible in population
-
BBC Pandemic Study: Pre-pandemic contact patterns from the UK
- Klepac, P., Kissler, S., & Gog, J. (2018). Contagion! The BBC Four Pandemic – The model behind the documentary. Epidemics, 24, 49-59.
-
CoMix Survey: Contact patterns during COVID-19 lockdowns
- CMMID COVID-19 working group, Jarvis, C. I., Van Zandvoort, K., Gimma, A., Prem, K., Klepac, P., Rubin, G. J., & Edmunds, W. J. (2020). Quantifying the impact of physical distance measures on the transmission of COVID-19 in the UK. BMC Medicine, 18(1), 124.
-
Sekara et al.: Large-scale gathering size distributions
- Sekara, V., Stopczynski, A., & Lehmann, S. (2016). Fundamental structures of dynamic social networks. Proceedings of the National Academy of Sciences, 113(36), 9977-9982.
expected_rate_per_gathering(): Calculates transmission risk per gatheringrestricted_rpldis(): Simulates gathering sizes under restrictionsmonte_carlo_simulation(): Estimates reduction in cases under restrictions
All figures are saved as PDF files in the 3_results/ directory:
expected_infections_example.pdf: Theoretical relationship between gathering size and infectionsfig3a.pdf,fig3b.pdf: Empirical gathering size distributionsfig4.pdf: Fitted power law parametersfig6.pdf: Effectiveness of gathering size restrictionsrr_kmax_*.pdf: Restriction effectiveness under various scenarios*_sensitivity.pdf: Sensitivity analysis results
If you use this code, please cite:
@article{boyer2022epidemics,
title={The effect of gathering restrictions on the spread of COVID-19},
author={Boyer, Christopher and Rumpler, Elisabeth and Kissler, Stephen M and Lipsitch, Marc},
journal={Epidemics},
volume={40},
pages={100620},
year={2022},
publisher={Elsevier},
doi={10.1016/j.epidem.2022.100620}
}For questions about the code or analysis, please contact:
- Christopher Boyer: cboyer@hsph.harvard.edu
This code is provided under MIT License for academic and research use.