Skip to contents

Squared error of the mean calculated as

$$ \textrm{mean}(\textrm{observed} - \textrm{mean prediction})^2 $$ The mean prediction is calculated as the mean of the predictive samples.

Usage

se_mean_sample(observed, predicted)

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

Examples

observed <- rnorm(30, mean = 1:30)
predicted_values <- matrix(rnorm(30, mean = 1:30))
se_mean_sample(observed, predicted_values)
#>  [1] 1.120954e+00 5.506171e-01 8.158564e+00 4.953364e-02 1.978748e-01
#>  [6] 3.924656e+00 4.315103e-03 1.971522e+00 5.325623e-03 3.438576e+00
#> [11] 4.944164e-02 9.564610e-04 6.898922e-01 3.784738e+00 1.028803e-01
#> [16] 2.632511e-05 3.644782e-01 6.029127e-01 8.747270e-01 2.939886e-01
#> [21] 2.574917e-04 5.380933e+00 1.563555e+00 1.536483e+00 1.565979e-02
#> [26] 1.691586e-01 1.467380e+01 2.184548e+00 1.223069e+00 1.486889e-01