Absolute Error of the Median (Sample-based Version)
Source:R/metrics_point_forecasts.R
ae_median_sample.Rd
Absolute error of the median calculated as
$$% \textrm{abs}(\textrm{true\_value} - \textrm{median\_prediction}) $$
Arguments
- true_values
A vector with the true observed values of size n
- predictions
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, predictions can just be a vector of size n.
Examples
true_values <- rnorm(30, mean = 1:30)
predicted_values <- rnorm(30, mean = 1:30)
ae_median_sample(true_values, predicted_values)
#> [1] 0.60862539 2.27543863 1.65090131 1.48887126 2.92914861 2.34141712
#> [7] 2.30798486 2.01417463 1.75018160 0.67530427 2.69671808 0.97742255
#> [13] 0.06300911 0.83433307 0.88221687 1.86763504 1.62297214 0.73554050
#> [19] 0.61482745 0.78771551 1.10751849 0.05759434 1.24529530 1.29931739
#> [25] 0.24281328 2.25642622 0.70611777 0.70430988 0.37513261 0.66686928