Skip to contents

This option estimates the effective reproduction number using penalized B-splines.

Usage

R_estimate_splines(
  knot_distance = 7,
  spline_degree = 3,
  coef_intercept_prior_mu = 1,
  coef_intercept_prior_sigma = 0.8,
  coef_sd_prior_mu = 0,
  coef_sd_prior_sigma = 0.25,
  link = "inv_softplus",
  R_max = 6,
  modeldata = modeldata_init()
)

Arguments

knot_distance

Distance between spline breakpoints (knots) in days (default is 7, i.e. one knot each week). Placing knots further apart increases the smoothness of Rt estimates and can speed up model fitting. The Rt time series remains surprisingly flexible even at larger knot distances, but placing knots too far apart can lead to inaccurate estimates.

spline_degree

Degree of the spline polynomials (default is 3 for cubic splines).

coef_intercept_prior_mu

Prior (mean) on the intercept of the random walk over spline coefficients.

coef_intercept_prior_sigma

Prior (standard deviation) on the intercept of the random walk over spline coefficients.

coef_sd_prior_mu

Prior (mean) on the daily standard deviation of the random walk over spline coefficients.

coef_sd_prior_sigma

Prior (standard deviation) on the daily standard deviation of the random walk over spline coefficients.

Link function. Currently supported are inv_softplus (default) and scaled_logit. Both of these links are configured to behave approximately like the identity function around R=1, but become increasingly non-linear below (and in the case of scaled_logit also above) R=1.

R_max

If link=scaled_logit is used, a maximum reproduction number must be assumed. This should be higher than any realistic R value for the modeled pathogen. Default is 6.

modeldata

A modeldata object to which the above model specifications should be added. Default is an empty model given by modeldata_init(). Can also be an already partly specified model returned by other EpiSewer modeling functions.

Value

A modeldata object containing data and specifications of the model to be fitted. Can be passed on to other EpiSewer modeling functions to add further data and model specifications.

The modeldata object also includes information about parameter initialization (init), meta data (.metainfo), and checks to be performed before model fitting (.checks).

Details

EpiSewer uses a random walk on the B-spline coefficients for regularization. This allows to use small knot distances without obtaining extremely wiggly Rt estimates.

  • The prior on the random walk intercept should reflect your expectation of Rt at the beginning of the time series. If estimating from the start of an epidemic, you might want to use a prior with mean larger than 1 for the intercept.

  • The prior on the daily standard deviation should be interpreted in terms of daily additive changes (this is at least true around Rt=1, and becomes less true as Rt approaches 0 or its upper bound as defined by the link function). For example, a standard deviation of 0.5 roughly allows the spline coefficients to change by ±1 (using the 2 sigma rule) each day. The daily standard deviation is multiplied by sqrt(knot_distance) to get the actual standard deviation of the coefficients. This way, the prior is independent of the chosen knot_distance. For example, if knot_distance is 7 days, and a daily standard deviation of 0.5 is used, the coefficients of two adjacent splines can differ by up to ±2.6. Note however that this difference does not directly translate into a change of Rt by ±2.6, as Rt is always the weighted sum of several basis functions at any given point. It may therefore change much more gradually, depending on the distances between knots.

The smoothness of the Rt estimates is influenced both by the knot distance and by the daily standard deviation of the random walk on coefficients. The latter also influences the uncertainty of Rt estimates towards the present / date of estimation, when limited data signal is available. Absent sufficient data signal, Rt estimates will tend to stay at the current level (which corresponds to assuming unchanged transmission dynamics).

The priors of this component have the following functional form:

  • intercept of the random walk over spline coefficients: Normal

  • standard deviation of the random walk over spline coefficients: Truncated normal

See also