Learn R Programming

scoringutils (version 2.1.0)

ae_median_sample: Absolute error of the median (sample-based version)

Description

Absolute error of the median calculated as $$ |\text{observed} - \text{median prediction}| $$ where the median prediction is calculated as the median of the predictive samples.

Usage

ae_median_sample(observed, predicted)

Value

Numeric vector of length n with the absolute errors of the median.

Arguments

observed

A vector with observed values of size n

predicted

nxN matrix of predictive samples, n (number of rows) being the number of data points and N (number of columns) the number of Monte Carlo samples. Alternatively, predicted can just be a vector of size n.

Input format

Overview of required input format for sample-based forecasts

See Also

ae_median_quantile()

Examples

Run this code
observed <- rnorm(30, mean = 1:30)
predicted_values <- matrix(rnorm(30, mean = 1:30))
ae_median_sample(observed, predicted_values)

Run the code above in your browser using DataLab