Skip to contents

This function computes core epidemiological summary statistics from deterministic compartmental epidemic models (e.g., SIR, SIS, SEIR).

Usage

epi_metrics(data, beta, gamma, N = NULL)

Arguments

data

A data frame returned by ode_*() functions. Must contain a column time, and at least S and I. Additional compartments such as E or R are allowed.

beta

Transmission rate (numeric).

gamma

Recovery / removal rate (numeric).

N

Total population (numeric). If NULL (default), it is computed as the sum of the known compartment columns (S, E, I, R) at the first time point; extra user-added columns are ignored.

Value

A named list with:

R0

Basic reproduction number.

peak_infection

Maximum number of infectious individuals.

peak_time

Time at which infectious peak occurs.

attack_rate

Proportion of population that transitioned out of S; defined only for models containing an R compartment (e.g., SIR/SEIR) and meaningful only for CLOSED populations.

Details

The input data frame is expected to be the output of ode_*() functions, containing a time column and one or more compartment columns (e.g., S, I, R, E). All compartment values are assumed to be in absolute population counts, and the total population is assumed to be conserved unless otherwise specified.

Examples

sir = ode_sir(
  init   = c(S = 990, I = 10),
  params = c(beta = 0.002, gamma = 0.1),
  times  = seq(0, 50, by = 0.1)
)
epi_metrics(sir, beta = 0.002, gamma = 0.1)
#> $R0
#> [1] 0.02
#> 
#> $peak_infection
#> [1] 10
#> 
#> $peak_time
#> [1] 0
#> 
#> $attack_rate
#> [1] 0.0002004762
#>