interpolate_median: Helper function to interpolate the median prediction if it is...

View source: R/metrics-quantile.R

interpolate_medianR Documentation

Helper function to interpolate the median prediction if it is not available

Description

Internal function to interpolate the median prediction if it is not available in the given quantile levels. This is done using linear interpolation between the two innermost quantiles.

Usage

interpolate_median(predicted, quantile_level)

Arguments

predicted

Vector of length N (corresponding to the number of quantiles) that holds predictions.

quantile_level

Vector of of size N with the quantile levels for which predictions were made. Note that if this does not contain the median (0.5) then the median is imputed as being the mean of the two innermost quantiles.

Value

scalar with the imputed median prediction

Input format

metrics-quantile.png

Overview of required input format for quantile-based forecasts


epiforecasts/scoringutils documentation built on Dec. 11, 2024, 11:12 a.m.