Squared Error of the Mean (Sample-based Version)
Source:R/metrics_point_forecasts.R
se_mean_sample.Rd
Squared error of the mean calculated as
$$ \textrm{mean}(\textrm{true\_value} - \textrm{prediction})^2 $$
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)
se_mean_sample(true_values, predicted_values)
#> [1] 0.77394841 1.01111794 11.02912184 4.90532223 2.56020025 0.02195793
#> [7] 2.76090589 2.03635257 0.12537056 0.51296868 4.61605491 0.33748314
#> [13] 0.14674311 4.86501849 23.11811168 2.72727320 0.90166468 10.79581353
#> [19] 0.34990149 1.30024405 1.36306936 5.62752202 0.52834759 0.95203665
#> [25] 4.83326989 1.56527458 0.96086778 0.02214336 2.43114610 0.41195893