How to simulate the final size with heterogeneity in social contact and infection susceptibility?
Published
March 26, 2024
Ingredients
This scenario assumes that, in the population, there is:
Heterogeneous social contact
Different susceptibility to the infection:
Between individuals of different age groups from 20% (infants) to 100% (65+), and
Within individuals of the same age group due the immunization effect of 25%.
The immunization uptake rate is also different for each of the age groups: immunization increases with age from 20% (infants) to 90% (65+)
Steps in code
# Simulate final size with heterogeneity in social contact and infection susceptibilitylibrary(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# Set and immunization effectimmunization_effect <-0.25# susceptibility matrixsusceptibility <-tibble(age_group = demography_groups,unimmunised =c(0.2, 0.5, 0.6, 0.9, 1.0)) %>%mutate(immunised = unimmunised * (1- immunization_effect)) %>%column_to_rownames(var ="age_group") %>%as.matrix()susceptibility
# R0 of the diseaser0 <-1.5# assumed for pandemic influenza# Calculate the proportion of individuals infected in each age groupfinal_size(r0 = r0,contact_matrix = contact_matrix_random,demography_vector = demography_vector,susceptibility = susceptibility,p_susceptibility = p_susceptibility)