Skip to contents

Expects a tidy quantile table (e.g. a hubverse quantile table or the output of scoringutils::as_forecast_quantile(). Treats any columns in that table other than those specifying the quantile level and the associated value as grouping variables, and returns them in the output table.

Usage

quantile_table_to_median_qi(
  quantile_table,
  value_col,
  quantile_level_col,
  .width = NULL,
  require_all_medians = TRUE,
  require_all_widths = TRUE,
  quantile_tol = 10
)

Arguments

quantile_table

Tidy table of quantiles, as an object coerceible to a tibble. Must have columns representing the quantile level and the associated value

value_col

Column in the table specifying values.

quantile_level_col

Column in the table specifying quantile levels

.width

Vector of interval width(s) to for which to create rows in the output. If NULL (the default), use all and only the widths that can be computed from quantiles available in quantile_table, as determined by get_available_qi_widths().

require_all_medians

Boolean. Error if the output is missing any medians? If TRUE, the function will succeed only if it can find a median (0.5 quantile) value for all groups present in the input and otherwise will error. Default TRUE.

require_all_widths

Boolean. Error if the output is missing any of the requested .widths for any group? If TRUE, the function will succeed only if it can calculate all the requested interval .widths for all the groups present in the input and otherwise will error. Default TRUE.

quantile_tol

Round values in the quantile_level_col to this many decimal places, to avoid problems with floating point number equality comparisons. Passed as the digits argument to base::round(). Default 10.

Value

A tibble in the output format of ggdist::median_qi()