Title: | Quantification of Population-Level Impact of Vaccination |
---|---|
Description: | Implements the compartment model from Tokars (2018) <doi:10.1016/j.vaccine.2018.10.026>. This enables quantification of population-wide impact of vaccination against vaccine-preventable diseases such as influenza. |
Authors: | Arseniy Khvorov [aut, cre] |
Maintainer: | Arseniy Khvorov <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0.9000 |
Built: | 2025-02-24 04:03:04 UTC |
Source: | https://github.com/khvorov45/impactflu |
Generates counts from a normal distribution density function.
generate_counts(init_pop_size, n_timepoints, overall_prop, mean, sd)
generate_counts(init_pop_size, n_timepoints, overall_prop, mean, sd)
init_pop_size |
Initial population size |
n_timepoints |
Number of timepoints |
overall_prop |
Overall proportion of the population to be included in the counts over all the timepoints |
mean |
Mean of the normal distribution |
sd |
Standard deviation of the normal distribution |
An integer vector of counts of length n_timepoints
# Tokars (2018) vaccinations vacs_tok <- generate_counts(1e6, 304, 0.55, 100, 50) # Tokars (2018) cases casen_tok <- generate_counts(1e6, 304, 0.12, 190, 35)
# Tokars (2018) vaccinations vacs_tok <- generate_counts(1e6, 304, 0.55, 100, 50) # Tokars (2018) cases casen_tok <- generate_counts(1e6, 304, 0.12, 190, 35)
Generate dates given timepoint indices, start date and step unit
generate_dates(timepoints, start, unit)
generate_dates(timepoints, start, unit)
timepoints |
Integer vector timepoint indices |
start |
Date of index 1 |
unit |
"year" "month" or "day" |
A vector of dates the same length as timepoints
# Dates from Tokars (2018) timepoints <- 1L:304L dates <- generate_dates(timepoints, lubridate::ymd("2017-08-01"), "day")
# Dates from Tokars (2018) timepoints <- 1L:304L dates <- generate_dates(timepoints, lubridate::ymd("2017-08-01"), "day")
Method 1 was said to be as current. Method 3 was determined to be the least biased.
method1(init_pop_size, vaccinations, cases, ve) method3(init_pop_size, vaccinations, cases, ve)
method1(init_pop_size, vaccinations, cases, ve) method3(init_pop_size, vaccinations, cases, ve)
init_pop_size |
Integer initial population size |
vaccinations |
Integer vector counts of vaccinations |
cases |
Integer vector counts of cases |
ve |
Vector vaccine effectiveness. If length 1, assumed to not vary with time. |
A tibble with the following columns (method-dependent):
cases |
Observed cases |
vaccinations |
Observed vaccinations |
ve |
Assumed vaccine effectiveness |
pvac |
Proportion of the starting population vaccinated |
vc_lag |
Vaccine coverage lagged |
pops |
Susceptible population |
pflu |
Infection risk |
popn |
Non-cases is absence of vaccination |
cases_novac |
Cases in absence of vaccination |
avert |
Expected number of vaccinations |
Tokars JI, Rolfes MA, Foppa IM, Reed C. An evaluation and update of methods for estimating the number of influenza cases averted by vaccination in the United States. Vaccine. 2018;36(48):7331–7337. doi:10.1016/j.vaccine.2018.10.026
library(dplyr) # Simulate a population nsam <- 1e6L ndays <- 304L pop_tok <- sim_reference( init_pop_size = nsam, vaccinations = generate_counts(nsam, ndays, 0.55, mean = 100, sd = 50), infections_novac = generate_counts(nsam, ndays, 0.12, mean = 190, sd = 35), ve = 0.48, lag = 14 ) # Summarise by month pop_tok_month <- pop_tok %>% mutate( datestamp = generate_dates( timepoint, lubridate::ymd("2017-08-01"), "day" ), year = lubridate::year(datestamp), month = lubridate::month(datestamp) ) %>% group_by(year, month) %>% summarise( vaccinations = sum(vaccinations), infections = sum(infections), ve = mean(ve) ) %>% ungroup() # Estimate averted infections using the two different methods m1 <- method1( nsam, pop_tok_month$vaccinations, pop_tok_month$infections, pop_tok_month$ve ) m3 <- method3( nsam, pop_tok_month$vaccinations, pop_tok_month$infections, pop_tok_month$ve ) sum(m1$avert) sum(m3$avert)
library(dplyr) # Simulate a population nsam <- 1e6L ndays <- 304L pop_tok <- sim_reference( init_pop_size = nsam, vaccinations = generate_counts(nsam, ndays, 0.55, mean = 100, sd = 50), infections_novac = generate_counts(nsam, ndays, 0.12, mean = 190, sd = 35), ve = 0.48, lag = 14 ) # Summarise by month pop_tok_month <- pop_tok %>% mutate( datestamp = generate_dates( timepoint, lubridate::ymd("2017-08-01"), "day" ), year = lubridate::year(datestamp), month = lubridate::month(datestamp) ) %>% group_by(year, month) %>% summarise( vaccinations = sum(vaccinations), infections = sum(infections), ve = mean(ve) ) %>% ungroup() # Estimate averted infections using the two different methods m1 <- method1( nsam, pop_tok_month$vaccinations, pop_tok_month$infections, pop_tok_month$ve ) m3 <- method3( nsam, pop_tok_month$vaccinations, pop_tok_month$infections, pop_tok_month$ve ) sum(m1$avert) sum(m3$avert)
Simulates an ideal population using the reference model from Tokars (2018).
sim_reference(init_pop_size, vaccinations, infections_novac, ve, lag)
sim_reference(init_pop_size, vaccinations, infections_novac, ve, lag)
init_pop_size |
Integer initial population size |
vaccinations |
Integer vector number of vaccinations at every timepoint |
infections_novac |
Integer vector number of infections at every timepoint |
ve |
Vaccine effectiveness (proportion) |
lag |
Integer lag period measured in timepoints |
A tibble with the following columns:
timepoint |
Index of timepoint |
vaccinations |
Expected number of vaccinations |
infections_novac |
Expected number of infections in absence of vaccination |
ve |
Expected vaccine effectiveness |
pflu |
Flu incidence |
infections |
Actual number of infections |
popn |
Non-cases in absence of vaccination |
pvac |
Proportion of starting population vaccinated |
b |
Number vaccinated at that time who didn't get infected later |
b_og |
Number vaccinated at that time |
A |
Non-vaccinated non-cases |
C |
Vaccinated susceptible |
D |
Vaccinated immune |
E |
Non-vaccinated infections cumulative total |
F |
Vaccinated infections cumulative total |
Tokars JI, Rolfes MA, Foppa IM, Reed C. An evaluation and update of methods for estimating the number of influenza cases averted by vaccination in the United States. Vaccine. 2018;36(48):7331–7337. doi:10.1016/j.vaccine.2018.10.026
# Population from Tokars (2018) nsam <- 1e6L ndays <- 304L pop_tok <- sim_reference( init_pop_size = nsam, vaccinations = generate_counts(nsam, ndays, 0.55, mean = 100, sd = 50), infections_novac = generate_counts(nsam, ndays, 0.12, mean = 190, sd = 35), ve = 0.48, lag = 14 ) head(pop_tok) sum(pop_tok$avert)
# Population from Tokars (2018) nsam <- 1e6L ndays <- 304L pop_tok <- sim_reference( init_pop_size = nsam, vaccinations = generate_counts(nsam, ndays, 0.55, mean = 100, sd = 50), infections_novac = generate_counts(nsam, ndays, 0.12, mean = 190, sd = 35), ve = 0.48, lag = 14 ) head(pop_tok) sum(pop_tok$avert)