
Energy score for multivariate forecasts
Source:R/metrics-multivariate-sample.R
energy_score_multivariate.RdCompute the energy score (Gneiting et al., 2008) for each
multivariate group defined by mv_group_id. The energy
score is a multivariate generalisation of the CRPS that
measures both calibration and sharpness of the forecast
distribution.
The score is computed using
scoringRules::es_sample().
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, if n = 1,
predictedcan just be a vector of size n.- mv_group_id
Numeric vector of length n with ids indicating the grouping of predicted values. Conceptually, each row of the
predictedmatrix could be seen as a separate (univariate) forecast. The grouping id then groups several of those forecasts together, treating them as a single multivariate forecast.- w
Optional numeric vector of weights for forecast samples (length equal to the number of columns of
predicted). IfNULL(the default), equal weights are used.