Skip to contents

Estimates the time-varying effective reproduction number \(R_t\) directly from compartment data. Two methods are available:

"mechanistic"

Uses \(R_t = \beta S(t) / (\gamma N)\). This is the standard formula for a frequency-dependent SIR-type model.

"normalized"

Uses \(R_t = R_0 \, S(t) / N\) with \(R_0 = \beta / \gamma\). Suitable when different normalisations are desired.

Usage

plot_Rt_estimate(df, params, N = NULL, method = c("mechanistic", "normalized"))

Arguments

df

A data frame with columns time and S.

params

A named numeric vector or list containing at least beta and gamma.

N

Total population size. If NULL (the default), it is estimated from the sum of all state columns at the first time step.

method

Estimation method: "mechanistic" (default) or "normalized".

Value

A ggplot object with a dashed horizontal line at \(R_t = 1\).

Examples

sir = model_sir(
  init   = c(S = 990, I = 10),
  params = c(beta = 0.002, gamma = 0.1),
  times  = seq(0, 50, by = 0.1)
)
plot_Rt_estimate(sir, params = c(beta = 0.002, gamma = 0.1))