Skip to contents

Converts predictions from nested format to quantile format suitable for forecast hub submissions. Computes specified quantiles from the sample distribution.

Usage

predictions_to_quantiles(
  nested_df,
  probs = c(0.01, 0.025, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55,
    0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 0.975, 0.99)
)

Arguments

nested_df

A tibble with a 'samples' list-column

probs

Numeric vector of quantile probabilities (default: standard hub quantiles from 0.01 to 0.99)

Value

A tibble in long format with columns: time_period, location, quantile, value

Examples

if (FALSE) { # \dontrun{
# Compute standard quantiles
quantile_preds <- predictions_to_quantiles(nested_preds)

# Compute specific quantiles
quantile_preds <- predictions_to_quantiles(
  nested_preds,
  probs = c(0.025, 0.25, 0.5, 0.75, 0.975)
)
} # }