Contact us
Back to knowledgebase

Continuous Ranked Probability Score (CRPS)

The continuous ranked probability score (CRPS) measures the error of a forecast distribution against one observation. For demand counted in whole units, the forecast gives a probability of filling the order from each possible stock level. Once demand is known, the answer at each level is either zero or one. CRPS sums the squared errors in those probabilities.

A demand forecast scores in parts, a lead-time forecast in days. Lower is better. On this scale a point forecast incurs its ordinary absolute error, so its average CRPS is the mean absolute error (MAE). A forecaster who knows the demand distribution exactly still incurs some error when several order quantities are possible.

From a demand histogram to a cumulative forecast

Two forecasters estimate how many units a customer will request. The first uses a negative-binomial distribution truncated to the range shown. Its two tallest bars are at eight and nine units, each with a probability just over 9%. The second forecaster predicts 12 units. The customer orders 15.

The demand histogram peaks at eight and nine units and extends to 26. A point forecast marks 12 and actual demand marks 15. Below, the cumulative forecast rises in steps while the observation jumps straight to one at 15.

The twelve-unit bar gives the chance of an order for exactly twelve. A depot holding twelve units could also fill any smaller order. Adding the bars up through twelve gives it a 74% chance of having enough stock. At fifteen units that chance reaches 89%. The lower plot traces these running totals, the forecast’s cumulative distribution function (CDF). The observed order has a much simpler CDF. It jumps from zero to one at fifteen.

Scoring the two sides of an observation

Let F(z) be the forecast probability that demand will be at most z. For observed demand y, the step function H(z) is zero below y and one from y onward. At any threshold z, the squared difference between the forecast and the observed step is the Brier score for the event that z units suffice. Integrating over thresholds gives CRPS.1

$$ S(F,y)=\int_{\mathbb R}[F(z)-H(z)]^2\,dz. $$

Split the integral where the observation steps up. Below y, the depot would have run short, and the error has magnitude F(z). From y onward, the error is the probability 1 − F(z) assigned to a shortage. The score is the sum of the two areas A and B.

$$ \begin{aligned} A &= \int_{-\infty}^{y} F(z)^2\,dz,\\ B &= \int_y^\infty [1-F(z)]^2\,dz. \end{aligned} $$

For nonnegative whole-unit demand, both curves are flat between consecutive integers. The integrals are exact sums of unit-width rectangles. Threshold y belongs in the second sum because a stock of y fills an order for y.

$$ \begin{aligned} A &= \sum_{k=0}^{y-1} F(k)^2,\\ B &= \sum_{k=y}^{\infty} [1-F(k)]^2. \end{aligned} $$

For the customer’s order of fifteen, thresholds below fifteen contribute 3.298 units. All the thresholds from fifteen onward contribute just 0.026. The distribution therefore scores 3.32 units, rounded. Each rectangle in the upper plot has the squared gap between the cumulative curves as its height. A gap of one tenth in the tail leaves a rectangle only one hundredth high.

At demand 15 the distribution scores 3.298 units below the observation and 0.026 above. For the point forecast of 12, the forecast step and observed step enclose a rectangle three units wide and one high.

For the point forecast, the two steps enclose a single rectangle. At thresholds 12, 13 and 14, the forecast said the order would be filled with certainty. It was short at all three. The rectangle is one high and three wide, giving a score of 3 units. An order below twelve would put the rectangle on the other side of the observation. Its width in either direction is the absolute error.

Hold the forecasts fixed and vary the order

Twelve was the better forecast on this order. To see how much that judgment depends on the customer having requested fifteen, score the same two forecasts at every order size from 1 to 26. Subtracting their scores in the lower plot makes the narrow margin in the upper tail visible.

The score of the 12-unit point forecast forms a V. The distribution's score bottoms out near nine. The point wins for observed demand of 11 through 16. The distribution wins below 11 and above 16 over the plotted range.

The point forecast wins for orders of 11 through 16 units, with a perfect score at twelve. At seventeen the distribution pulls ahead, 4.93 against 5. Beyond 26 units both forecasts have exhausted their probability mass. Each further unit ordered adds one to both scores, leaving their curves parallel.

The histogram explains the shape of the score curve. Increase the order from y to y + 1. Only at threshold y does the answer change. Its contribution goes from [1 − F(y)]² to F(y)², a change of **2F(y) − 1**. The score falls until the cumulative probability reaches one half. At each integer the slope increases by twice the probability mass there. At eight and nine it increases by nearly 0.19 each time, giving the curve its rounded bottom. A point forecast concentrates the entire bend at the tip of its V.

An order for nine is far more common under this forecast than an order for twenty-six. If demand follows the plotted histogram, weighting each score by its bar gives an average of 2.45 units for the distribution and 4.00 for the point forecast of twelve. Moving the point forecast to nine, the median and its best possible position, brings its average down to 3.49. These averages depend on which orders come in. A customer who always orders twelve would give the point forecast of twelve a perfect record. A backtest gets its frequencies from orders on held-out dates.

Why the true distribution wins on average

At a given stock level, let g be the true probability of filling the order and p the quoted probability. The depot has enough stock with probability g, incurring a squared error of (1 − p)², and runs short with probability 1 − g, incurring p². Its expected loss is g(1 − p)² + (1 − g)p². Expanding the squares gives g(1 − g) + (p − g)². The first term remains even for a forecaster who knows g. Quoting p in its place costs an extra (p − g)².

Write G for the true distribution given the information available when the forecast was issued. The excess expected loss Δ incurred by issuing F instead of G is the sum of those penalties across thresholds.2

$$ \Delta=\int_{\mathbb R}[F(z)-G(z)]^2\,dz. $$

Two distinct CDFs differ over an interval of positive length, so the integral is positive whenever F differs from G. Among distributions with finite first absolute moments, G alone minimizes expected CRPS. This property is called strict propriety.

In a historical comparison, average each forecaster’s scores over the same T cases, including periods with no requests. Use forecasts based on the information available at issue time and score them against requested quantities. If the depot sold its last twelve units, the invoice alone cannot distinguish an order for twelve from an order for fifteen.

$$ \overline S=\frac{1}{T}\sum_{t=1}^{T} S(F_t,y_t). $$

The two days before a delivery

A depot has one pack of four parts left. Two working days will pass before the next delivery becomes usable. On either day the crew has an even chance of requesting a pack or requesting nothing. If the two days are independent, demand before delivery is zero, four or eight parts with probabilities ¼, ½ and ¼.

Suppose the crew requests a pack both days. At starting stocks of zero through three, the forecast gave a ¼ chance of covering demand. At four through seven it gave a ¾ chance. All eight stock levels would have run short. The score is 4 × (¼)² + 4 × (¾)² = 2.50 parts. Summing over just the three quantities in the histogram would miss the four-unit width of each step. In packs the same score is 2.50 / 4 = 0.625.

Eight parts were requested. From zero to four parts the squared probability error is one sixteenth. From four to eight it is nine sixteenths. The two areas sum to a CRPS of 2.50 parts.

How would a standing forecast of four parts fare over the same two days? It gets the total exactly right half the time and misses by a whole pack on the other occasions. Both columns below are scores in parts.

Demand (chance) Model Point
0 parts (¼) 2.50 4
4 parts (½) 0.50 0
8 parts (¼) 2.50 4
Expected score 1.50 2.00

The last row assumes independent days. Suppose instead that the crew has one job booked and is equally likely to do it on either day. One pack will certainly suffice. A different schedule puts jobs in pairs, with equal chances of two busy days or two idle ones. Now a single pack will last only half the time.

Each day has a 50% chance of a four-part request. Before delivery, the chance of needing eight parts is zero if only one day is busy, 25% if the days are independent, and 50% if the crew works both days or neither.

Issued before the crew starts work, the three forecasts agree on the odds for each day. Whichever days turn out busy, each model scores 1 part per day. Years of daily scores would leave them tied. Their probabilities of needing a second pack before delivery are 0%, 25% and 50%. To test that difference, score each model’s two-day distribution against the two days’ requests added together.

With an uncertain delivery date, lead demand includes all requests until the receipt becomes usable. In a simulation, stop each demand path at its own receipt date to obtain a distribution of totals. In the request log, stop at the actual receipt date to obtain the observation. For a depot ordering only on Fridays, the period to cover may extend through the week until the next order and the lead time on that order.

If the supplier tends to run late in busy weeks, drawing its delivery dates independently of demand understates the chance of heavy requests coinciding with a late arrival. Even a forecast that gets the total right can put the work on the wrong day. For a crew already on site on Monday, parts available on Tuesday may be of little use.3

Computing CRPS from simulations or quantiles

When a simulator supplies draws from the forecast, CRPS can be computed directly from distances. Let X and X′ be independent draws and y the observed demand.2

$$ S=\mathbb{E}|X-y|-\tfrac12\mathbb{E}|X-X'|. $$

Scoring each draw by absolute error alone would give the simulator every incentive to return the median on every draw. The second term gives credit for the spread in the forecast. In the independent-days example, two draws differ by 3 parts on average. When the crew requests eight parts, a draw lies 4 parts from that order on average. The score is 4 − 3/2 = 2.50, the same area as in the plot.

If the customer receives a list of m equally likely scenarios, score that list as delivered. Average the first distance over the list and the second over all m² ordered pairs, including self-pairs. Sorting makes the pair sum inexpensive. The ith smallest draw supplies the upper value in i − 1 unordered pairs and the lower value in m − i others. One pass through the sorted list suffices.

When comparing simulators, a short list of draws can make a good model look worse. Each draw is paired with itself once, guaranteeing a distance of zero. To estimate the underlying simulator’s CRPS, average the second distance over the m(m − 1) pairs with distinct indices. With at least two independent draws the estimate is unbiased. Two different draws can still have the same value, and those zero distances count.4

If the forecast comes as a quantile function, the same score is twice the integral of pinball loss over quantile levels from zero to one. A finite table of percentiles gives an approximation. A simple average of losses at the 50th, 90th, 95th and 99th percentiles gives the upper tail much more weight than it has in CRPS.5

A rare order can matter little to the score

A spare part has no demand in 99% of weeks. In the remaining 1%, a customer orders 100 units. A standing forecast of zero averages 1.00 unit of CRPS. The true distribution averages 0.99. Across all 100 stock thresholds where the forecasts differ, the error in the probability quoted by the standing forecast is only one percentage point. Its excess expected loss is 100 × 0.01² = 0.01 units.

In the week the order arrives, the zero forecast incurs a CRPS of 100 parts. Its logarithmic loss is infinite because it assigned that order zero probability. After using CRPS in aerospace and fashion, Lokad’s forecasting team described its switch to cross-entropy in 2018. One reason was the modest penalty CRPS can assign to ruling out an event that subsequently occurs.

If the depot pays $800 in emergency freight each time the order arrives, holding a hundred units would save $8 a week on average in freight alone. The buyer can compare that saving with the cost of keeping the parts on the shelf. The financial value of the forecast depends on whether it changes his order. The statistical gain of 0.01 units is the same either way.

References


  1. James E. Matheson and Robert L. Winkler, “Scoring Rules for Continuous Probability Distributions,” Management Science, 1976. ↩︎

  2. Tilmann Gneiting and Adrian E. Raftery, “Strictly Proper Scoring Rules, Prediction, and Estimation,” University of Washington, Department of Statistics, Technical Report 463, 2004. The published paper of the same title appeared in the Journal of the American Statistical Association, 2007. Equations 20–21 give the integral and expectation forms. ↩︎ ↩︎

  3. Introduction to Supply Chain, §7.4.7, “High-dimensional forecasts.” The lecture Lead Time Forecasting applies CRPS to delivery times measured in days. ↩︎

  4. Christopher A. T. Ferro, “Fair scores for ensemble forecasts,” Quarterly Journal of the Royal Meteorological Society, 2014. ↩︎

  5. Johannes Bracher, Evan L. Ray, Tilmann Gneiting and Nicholas G. Reich, “Evaluating epidemic forecasts in an interval format,” PLOS Computational Biology, 2021. ↩︎