simulate_infections: Simulate a series of infections

View source: R/simulate.R

simulate_infectionsR Documentation

Simulate a series of infections

Description

Perform a simulation of infections through time, based on a reproductive number course, a series of imported cases and a serial interval distribution.

Usage

simulate_infections(Rt, imported_infections = 1, mean_SI = 4.8, sd_SI = 2.3)

Arguments

Rt

Numeric vector. Reproductive number values through time.

imported_infections

Positive integer vector. Must be of length at least one. Does not need to be the same length as Rt. If imported_infections is of greater length than Rt then Rt is padded with zeroes to reach the same length.

mean_SI

Numeric positive value. Mean of serial interval of epidemic simulated.

sd_SI

Numeric positive value. Standard deviation of serial interval of epidemic simulated.

Value

Integer vector. Simulated infections through time.

Examples

## Basic usage of simulate_infections
# Simulating infection incidence corresponding to a drop in Re value from 2.3
# to 0.5, at the half of the time period, then recovering the Re values using the
# estimate_Re function

Re_evolution <- c(rep(2.3, 100), rep(0.5, 100))
simulated_incidence_1 <- simulate_infections(
  Rt = Re_evolution
)
Re_recovered_1 <- estimate_Re(simulated_incidence_1)


## Advanced usage of simulate_infections
# Simulating infection incidence using the same Re progression as above, but a
# assuming a constant import of 100 cases per day

imported_infections <- rep(100, length(Re_evolution))
simulated_incidence_2 <- simulate_infections(
  Rt = Re_evolution,
  imported_infections = imported_infections
)
Re_recovered_2 <- estimate_Re(simulated_incidence_2)


covid-19-Re/estimateR documentation built on Sept. 14, 2024, 5:49 a.m.