impactflu (version 0.1.0)

sim_reference: Simulate an ideal population

Description

Simulates an ideal population using the reference model from Tokars (2018).

Usage

sim_reference(
  init_pop_size,
  vaccinations,
  cases_novac,
  ve,
  lag,
  deterministic,
  seed = sample.int(.Machine$integer.max, 1)
)

Arguments

init_pop_size

Integer initial population size

vaccinations

Integer vector number of vaccinations at every timepoint

cases_novac

Integer vector number of cases at every timepoint

ve

Vaccine effectiveness (proportion)

lag

Integer lag period measured in timepoints

deterministic

Boolean whether to make the simulation deterministic

seed

Integer seed to use

Value

A tibble with the following columns:

timepoint

Index of timepoint

vaccinations

Expected number of vaccinations

cases_novac

Expected number of cases in absence of vaccination

ve

Expected vaccine effectiveness

pflu

Flu incidence

cases

Actual number of cases

popn

Non-cases in absence of vaccination

pvac

Proportion of starting population vaccinated

b

Number vaccinated at that time

A

Non-vaccinated non-cases

B

Vaccinated non-cases lagging

E

Non-vaccinated cases

References

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<U+2013>7337. doi:10.1016/j.vaccine.2018.10.026

Examples

Run this code
# NOT RUN {
# 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),
  cases_novac = generate_counts(nsam, ndays, 0.12, mean = 190, sd = 35),
  ve = 0.48,
  lag = 14,
  deterministic = TRUE
)
head(pop_tok)
sum(pop_tok$avert)
# }

Run the code above in your browser using DataLab