epiverse-trace / epiverse-trace/finalsize
p_infected > susceptibility for high R0 values
- Dominant language
- R
- Stars
- 15
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
Hello! I have been testing the package to model diseases like measles or pertussis with high R0 values and I wanted to know if there are any limitations regarding the range of R0s the calculations of final size are acceptable/doable for. For example, I was replicating the example in: https://epiverse-trace.github.io/finalsize/articles/varying_susceptibility.html using an r0 of 10 and the p_infected that the model returns is bigger than the suscetpibility provided for the different age groups. Code follows:
library(tidyverse)
library(finalsize)
# get UK polymod data
polymod <- socialmixr::polymod
contact_data <- socialmixr::contact_matrix(
polymod,
countries = "United Kingdom",
age.limits = c(0, 5, 18, 40, 65),
symmetric = TRUE
)
# get the contact matrix and demography data
contact_matrix <- t(contact_data$matrix)
demography_vector <- contact_data$demography$population
# scale the contact matrix so the largest eigenvalue is 1.0
contact_matrix <- contact_matrix / max(Re(eigen(contact_matrix)$values))
# divide each row of the contact matrix by the corresponding demography
contact_matrix <- contact_matrix / demography_vector
n_demo_grps <- length(demography_vector)
r0 <- 10
susc_variable <- matrix(
data = c(0.75, 0.8, 0.85, 0.9, 1.0)
)
n_susc_groups <- 1L
p_susc_uniform <- matrix(
data = 1.0,
nrow = n_demo_grps,
ncol = n_susc_groups
)
final_size_heterog <- final_size(
r0 = r0,
contact_matrix = contact_matrix,
demography_vector = demography_vector,
susceptibility = susc_variable,
p_susceptibility = p_susc_uniform,
solver = 'iterative'
)
final_size_heterog
The results are:
I noticed that when just calling final_size(15), there are some warnings (though not in the previous case)
Thank you for the attention, as well as the package!
Contributor guide
Research direction
Start by running the supplied final_size() example with r0 = 10 and then the simpler final_size(15) call, noting the returned warnings and p_infected values. Trace the iterative solver behavior for heterogeneous susceptibility and compare its results with the supplied susceptibility values. Done means determining whether this is expected behavior or a calculation limitation, then documenting or correcting the confirmed issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- analytics, data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100