Code to analyze data on sexual networks and its impacts on mpox transmission during the 2022-2023 outbreak.
The results are presented in the Journal of Infectious Disease article titled Characteristics of the sexual networks of men who have sex with men in Montréal, Toronto, and Vancouver: Insights from Canada's 2022 mpox outbreak (February 2024).
Briefly, the first number in the file prefix means the following
1
: descriptive analyses,2
: main analyses (degree distribution, mpox R0 estimation), and3
: sensitivity and supplementary analyses (alternative outcome: anal partnerships, restriction, covariate standardization), mpox Re from mpox incidence data.
The second number is simply to maintain files in order.
NB: R0 is the basic reproduction number and Re is the effective or instantaneous reproduction number.
11_descr_table1.R
produces Table 1 (correlates of & summary statistics of number of partners).12_descr_retention_ipcw.R
computes the IPCWs (details in Supplementary Materials section RDS-II weights and inverse probability of censoring weights) and produces Table S3 (retention of participants).13_descr_phac_mpox_data.R
subsets and formats the mpox incidence data from PHAC (link).
-
Scripts
21
through23
fit the negative binomial regression models (21_distr_fit_negbin_coef.R
), perform the post-stratification (src-stan/regression_negbin_aggregate.stan
), and compute the fitted population-wide distribution of the number of sexual partners based on the post-stratified samples (script22_distr_fit_negbin_predictive.R
).- Script
21
also produces Table S4 (regression coefficients). - The post-stratification procedure is explained in detail in Supplementary Materials section Distribution of sexual partner numbers (Bayesian regression and post-stratification).
23_distr_fit_negbin_figs.R
generates Figure 1 (CDF of the number of sexual partners in P6M in each city) and Figure S1 (model fit).
- Script
-
Scripts
24
through27
compute the mpox R0 using the next-generation matrix (NGM).24_r0_categorize_pmf.R
partitions the population into sexual activity groups with pre-specified sizes (as a % of the total population), based on the estimated distributions from21
–23
(Table S7).25_r0_seir_model.R
computes the mpox R0 in two steps:- A SEIR-type model is calibrated to public mpox incidence data (formatted in
13
) in order to estimate natural history parameters (Table S2). (See Supplementary Materials section Reproduction number using a risk-stratified deterministic SEIR model and the next-generation matrix for model equations,src/seir_fns.R
for model code). - The NGM method is used to compute the mpox R0 based on the fitted distribution of sexual partner numbers estimated above and the city-specific parameters estimated with the SEIR model. This script also computes the Re assuming set proportions of the population are immune (in the highest-activity groups), and projects the mpox R0 and Re based on pre-COVID-19 sexual activity levels.
- A SEIR-type model is calibrated to public mpox incidence data (formatted in
- From the results produced by
25
,26_r0_seir_outputs.R
generates Figure 2 (SEIR model fit) and Figure 3 (R0 and Re based on the NGM method). - As a comaprison to the main results based on the NGM,
27_r0_growth_rate.R
computes the mpox R0 based on the growth-rate in reported mpox cases over time, presented in Table S5.- This script also produces Figure S2 (cumulative mpox incidence in each province).
31_supp_restriction.R
performs the restriction sensitivity analysis, which fits the regression models restricting the analytical sample to participants who had visits at all three timepoints. Results are in Figure S3.32_supp_standardization.R
performs the regression-based standardization. Results are in Figure S4.- Scripts
21
through23
described in the previous section can be modified to use the alternative anal partners in P6M outcome variable, or to use a zero-inflated negative binomial model for the main outcome variable. Results are shown in Figure S5 and Figure S6, respectively. 33_supp_sensitivity_figs.R
generates Figures S3–S6 from the analyses described above.34_supp_rt_case.R
estimates the Re using the EpiEstim package, and results of which are shown in Figure S8.