Add the fair CRPS for sample forecasts

Open
#1,281 1 comment 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
r
Domain
data

Research direction

Start by reading R/metrics-sample.R for crps_sample() and R/metrics-multivariate-sample.R for the energy score, then inspect how each builds sample matrices and handles separate_results. Add an estimator choice that preserves the current default and supports the fair formula in the issue. Done means both scores use the selected estimator, including the dispersion term when requested, with tests covering the default and fair results.

Written by the indexing model from the issue text.

Description

crps_sample() and es_sample() use the empirical estimators of scoringRules, which are biased in the ensemble size. A fair (ensemble-size-corrected) version would make scores comparable across forecasts with different numbers of samples.

What the fair CRPS is. For m samples X_1, ..., X_m and observation y, the fair CRPS is an unbiased estimator of E|X − y| − E|X − X'|/2:

(1/m) Σ_i |X_i − y| − (1/(2m(m−1))) Σ_{i≠j} |X_i − X_j|

The usual estimator divides the second sum by 2m², which biases the score by an amount of order 1/m, so small ensembles score worse than large ones.
The fair energy score is the same with the norm ‖·‖ in place of |·|.

Why it matters. Hub ensembles, and our own model draws, come with different numbers of samples (for example 100 and 1000).
With the usual estimator the score depends on that number, so models are not compared on the same footing unless the samples are subsampled to a common size.

What exists.

  • scoringutils (current main, R/metrics-sample.R): crps_sample() passes ... to scoringRules::crps_sample() and has no fair estimator. R/metrics-multivariate-sample.R calls scoringRules::es_sample(). NEWS has no mention of a fair score, and a search of open and closed issues for "fair crps" and "ensemble size" finds nothing.
  • scoringRules 1.1.3: crps_sample(y, dat, method = "edf", w, bw, num_int, show_messages) offers edf and kde only, and es_sample(y, dat, w) has no option, so there is nothing for scoringutils to pass through.
  • Python scoringrules: crps_ensemble(..., estimator="fair") gives the fair CRPS (other estimators include nrg, pwm, int).

Suggested API. Add an estimator argument to crps_sample(), with the current scoringRules behaviour as the default so nothing changes (for example estimator = c("default", "fair")), and the same for the multivariate energy score.
separate_results = TRUE would use the chosen estimator for the dispersion term too.
The fair estimator is a few lines of vectorised R on the sample matrix, so it need not wait for scoringRules.

References.

  • Ferro, C. A. T. (2014). Fair scores for ensemble forecasts. Quarterly Journal of the Royal Meteorological Society, 140, 1917-1923. doi:10.1002/qj.2270
  • Zamo, M. and Naveau, P. (2018). Estimation of the continuous ranked probability score with limited information and applications to ensemble weather forecasts. Mathematical Geosciences, 50, 209-234. doi:10.1007/s11004-017-9709-7

This was opened by a bot. Please ping @seabbs for any questions.

Dominant language
R
Stars
67
Forks
24
Avg merge
1h 24m
Merged PRs (30d)
2

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from epiforecasts/scoringutils

All issues in epiforecasts/scoringutils

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.