compute_lambda: Total infectiousness (renewal-equation convolution)

View source: R/computeLambda.R

compute_lambdaR Documentation

Total infectiousness (renewal-equation convolution)

Description

Computes the "total infectiousness" Lambda_t: the convolution of past incidence with a discretized Gamma(mean, variance) generation interval distribution, as required by epi_filter() and epi_smoother() alongside raw incidence. Written to avoid a dependency on the EpiEstim package's overall_infectivity() for this single step.

Usage

compute_lambda(incidence, mean_GI, var_GI, max_si = NULL)

Arguments

incidence

numeric vector of case counts, length n

mean_GI

mean generation interval, in the same time units as incidence (e.g. weeks if incidence is weekly)

var_GI

variance of the generation interval, same time units

max_si

maximum serial interval to consider (defaults to length(incidence) - 1)

Details

The Gamma(mean, variance) discretization approach follows the convention used in get_Rt.m, part of the GrowthPredict toolbox: Chowell G, Bleichrodt A, Dahal S, Tariq A, Roosa K, Hyman JM, Luo R. (2024) "GrowthPredict: A toolbox and tutorial-based primer for fitting and forecasting growth trajectories using phenomenological growth models." Scientific Reports 14, 1630. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1038/s41598-024-51852-8")}

Value

numeric vector of length n; Lambda[1] is NA (no prior incidence exists to convolve with)

Examples

data(measles_cdmx)
Lambda <- compute_lambda(measles_cdmx$cases, mean_GI = 11/7, var_GI = (4/7)^2)

RtForecastR documentation built on Nov. 25, 2026, 9:09 a.m.