crps
crps, function
def pure crps(r: ranvar, n: number): number
def pure crps(r1: ranvar, r2: ranvar): number
Computes the Continuous Ranked Probability Score (CRPS). With crps(r, n), the score is between the predictive distribution r and the observed value n. With crps(r1, r2), it is the extended CRPS between two predictive distributions.
r: the predictive distribution to compare to observationn.n: the observed value.r1: the first predictive distribution.r2: the second predictive distribution.
Examples
r = poisson(3)
r1 = poisson(3)
r2 = poisson(7)
show table "CRPS" with
crps(r, 4) as "crps(r, 4)"
crps(r1, r2) as "crps(r1, r2)"
Output:
| crps(r, 4) | crps(r1, r2) |
|---|---|
| 0.6825997 | 1.836925 |
Remarks
Let $X_1$ and $X_2$ be two random variables with cumulative distribution functions $F_1$ and $F_2$. The CRPS between $X_1$ and $X_2$ is:
$$CRPS(X_1, X_2) = \int_{-\infty}^{+\infty} (F_1(x) - F_2(x))^2 dx$$