recurs_predict_quantiles: Bayesian recursive prediction with arbitrary quantile levels...

View source: R/recursPredictQuantiles.R

recurs_predict_quantilesR Documentation

Bayesian recursive prediction with arbitrary quantile levels (internal)

Description

Generalizes recurs_predict() to report an arbitrary set of quantile levels rather than just 50%/95%, needed for the weighted interval score (wis()). Same Poisson-renewal/posterior marginalisation logic; this only widens what's read off the already-computed CDF, so it never changes point predictions or the 50%/95% values a call to recurs_predict() would give, only how many quantiles are reported alongside them.

Usage

recurs_predict_quantiles(
  Rgrid,
  pR,
  Lday,
  Rmean,
  quantile_levels = c(0.025, 0.25),
  maxI = 800
)

Arguments

Rgrid

grid on reproduction numbers

pR

posterior over R (filtered or smoothed)

Lday

total infectiousness at each time point

Rmean

mean R estimate at each time point

quantile_levels

vector of probabilities in (0, 0.5), each producing a nested (level, 1-level) interval. Default matches recurs_predict()'s 50%/95% reporting; pass e.g. seq(0.05, 0.45, by = 0.05) to add the levels a WIS calculation typically wants.

maxI

upper bound of the internal prediction grid

Details

Bracher J, Ray EL, Gneiting T, Reich NG. (2021) "Evaluating epidemic forecasts in an interval format." PLOS Computational Biology 17(2): e1008618. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1371/journal.pcbi.1008618")}

Value

list(pred, quantiles): mean one-step-ahead prediction, and a named list where quantiles[[as.character(level)]] is a 2 x (n-1) matrix with rows lo/hi for that (level, 1-level) interval


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