How to simulate the effective reproductive number (Reff) with heterogeneity in social contact?
Published
March 26, 2024
Ingredients
Account for heterogeneous social contact
Assume homogeneous susceptibility in all age groups
Steps in code
library(finalsize)library(socialmixr)library(tidyverse)# get UK polymod datapolymod <- socialmixr::polymodcontact_data <- socialmixr::contact_matrix( polymod,countries ="United Kingdom",age.limits =c(0, 5, 18, 40, 65),symmetric =TRUE)# get the contact matrix and demography datacontact_matrix <-t(contact_data$matrix)# scale the contact matrix so the largest eigenvalue is 1.0# this is to ensure that the overall epidemic dynamics correctly reflect# the assumed value of R0contact_matrix_scaled <- contact_matrix /max(Re(eigen(contact_matrix)$values))# Define population in each age groupdemography_vector <- contact_data$demography$populationdemography_groups <- contact_data$demography$age.groupdemography_vector
[1] 3453670 9761554 18110368 19288101 9673058
demography_groups
[1] "[0,5)" "[5,18)" "[18,40)" "[40,65)" "65+"
# divide each row of the contact matrix by the corresponding demography# this reflects the assumption that each individual in group {j} make contacts# at random with individuals in group {i}contact_matrix_random <- contact_matrix_scaled / demography_vector# Define susceptibility of each group# susceptibility matrixsusceptibility <-tibble(age_group = demography_groups,susceptible =c(0.8, 0.8, 0.8, 0.8, 0.8)) %>%column_to_rownames(var ="age_group") %>%as.matrix()susceptibility