Skip to contents

Computes the time-varying reproduction number (Rt), defined as the average number of secondary infections generated by each infected individual at time t, accounting for the generation interval distribution: $$R_t = \frac{I_t}{\sum_{k=0}^{\tau_{\max}-1} I_{t-k} \cdot \frac{g(k)}{g_a}}$$

Usage

Rt(fitted_model, gi_dist, tau_max = 7, ...)

# S3 method for class 'ps'
Rt(fitted_model, gi_dist, tau_max = 7, ...)

# S3 method for class 'rw'
Rt(fitted_model, gi_dist, tau_max = 7, ...)

# S3 method for class 'ps_single'
Rt(fitted_model, gi_dist, tau_max = 7, ...)

# S3 method for class 'rw_single'
Rt(fitted_model, gi_dist, tau_max = 7, ...)

Arguments

fitted_model

Fitted model object with class EpiStrainDynamics.fit

gi_dist

Function returning the generation interval probability for a given day. Must accept a numeric vector and return a non-negative numeric vector of the same length; does not need to sum to 1 (see Description).

tau_max

Integer maximum generation interval in days (default: 7)

...

Additional arguments passed to metrics calculation

Value

named list of class EpiStrainDynamics.metric containing a dataframe of the calculated metric outcome ($measure), the fit object ($fit), and the constructed model object ($constructed_model). The measure data frame contains the median of the epidemiological quantity (y), the 50% credible interval of the quantity (lb_50 & ub_50), the 95% credible interval (lb_95 & ub_95), the proportion greater than a defined threshold value (prop), the pathogen name (pathogen), and the time label (time).

Details

Where:

  • \(I_t = \exp(\log\text{-incidence}_t)\) is the current incidence

  • \(g(k)\) is the generation interval probability for day k

  • \(g_a = \sum_{k=0}^{\tau_{\max}-1} g(k)\) is the normalization constant

  • \(\tau_{\max}\) is the maximum generation interval in days

This metric quantifies current transmission potential by comparing present incidence to the weighted historical incidence that could have generated it, where:

  • \(R_t > 1\): Epidemic is growing (each case generates >1 secondary case)

  • \(R_t = 1\): Epidemic is stable (replacement level transmission)

  • \(R_t < 1\): Epidemic is declining (each case generates <1 secondary case)

  • Threshold of 1 is epidemiologically meaningful for control decisions

Generation interval considerations:

  • Accounts for transmission timing using probability distribution \(g(k)\)

  • Recent cases contribute more to current transmission potential

  • Accepts user-defined generation interval distributions, validated for structural properties (vectorized, non-negative, finite)

  • Does not need to sum to 1 – normalized internally using \(g_a = \sum_{k=0}^{\tau_{\max}-1} g(k)\)

  • Validation does not assess whether the shape is epidemiologically plausible (e.g. unimodal, decaying); as with other Rt estimation methods, supplying a distribution informed by published estimates for the pathogen(s) being modelled is the user's responsibility

This metric function can be run directly on the fitted model output.

See also

Examples

if (FALSE) { # interactive()
mod <- construct_model(
  pathogen_structure = single(
    case_timeseries = sarscov2$cases,
    time = sarscov2$date
  ),
  method = random_walk()
)

fit <- fit_model(mod)

rt <- Rt(fit, gi_dist = function(x) 4 * x * exp(-2 * x), tau_max = 7)
}