Foundations to Frontier
Tests
K. Time Series and Sensor Data › K2 Deep Learning for Time Series

Probabilistic forecasting

A point forecast says what will most likely happen; a probabilistic forecast says how uncertain that is, as quantiles, intervals, samples or a full distribution. This page implements the scores used to judge such forecasts (pinball loss, CRPS, interval coverage and the PIT histogram) and compares four ways to produce them on a series whose volatility comes in bursts: a Gaussian with constant spread, split conformal prediction, quantile regression with a volatility feature, and conformal prediction scaled by that feature.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

How sure is the forecast?

Saying ‘tomorrow’s demand will be 100’ is not enough to decide how much stock to keep. A probabilistic forecast adds a range, such as ‘between 80 and 125 with 90% probability’. A good range is right as often as it claims (calibration), and as narrow as possible while staying right (sharpness). In calm periods the range should shrink; in turbulent periods it should widen.

Deep forecasting lab
AR(1) with GARCH volatility (persistence 0.95, ARCH α = 0.25); last 200 test points. 90% bands for the next value: constant Gaussian (dashed, width 2.73) covers 90% overall and 79% in the most volatile third; the band scaled by recent volatility (mean width 2.96) covers 88% and 93%.
Why engineers care

Weather services have issued probability forecasts of rain since the 1960s, and the scores used here, such as the CRPS, were developed largely for them.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A 90% interval should contain the outcome…
  2. 2. Calibration means the stated probabilities…
  3. 3. Sharpness means intervals are…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Forms: quantiles at chosen levels, prediction intervals, sample paths, or a parametric distribution (Gaussian, Student t, negative binomial).
  • Pinball loss: for level τ, L_τ(y, q) = τ(y − q) if y ≥ q, else (1 − τ)(q − y). Its expected value is minimised by the true τ-quantile.
  • CRPS: the integral of the squared difference between the forecast CDF and the step at the outcome. It equals E|X − y| − ½E|X − X′|, and twice the average pinball loss over all levels. It is in the units of the data, and reduces to absolute error for a point forecast.
  • Interval score: width plus 2/α times any miss, for a central (1 − α) interval.
  • Calibration checks: coverage of intervals, and the PIT histogram of F(y), which is flat when the forecast is calibrated, U-shaped when it is too narrow and hump-shaped when it is too wide.
  • Methods: Gaussian or other distributional models (DeepAR, NGBoost), quantile regression and quantile neural networks, conformal prediction, ensembles and bootstrap.
📝 Quick check (Level 1)
0/3 answered
  1. 1. The pinball loss at level τ is minimised by…
  2. 2. For a point forecast the CRPS equals…
  3. 3. A U-shaped PIT histogram means the forecast is…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

Scores and four forecasters

Exercise 1.

  • Pinball loss, the closed-form Gaussian CRPS, the CRPS from samples and from 19 quantiles.
  • Check that the three CRPS estimates agree on standard normal data and match the theory value 1/√π.
  • Check that the 0.9 pinball loss is smallest at the true quantile, and look at PIT histograms of a correct and a too-wide forecast.

Practice.

  • Report calibration and sharpness together: coverage alone rewards very wide intervals, width alone rewards overconfidence.
  • Use proper scores (CRPS, pinball, log score) to compare methods.
  • Check calibration by condition, for example in calm and volatile periods, not only overall.
  • Keep quantiles ordered: separately fitted quantile models can cross; sort them.
  • Tools: properscoring and scoringrules for CRPS; statsforecast and NeuralForecast for distributional models; MAPIE for conformal intervals; GluonTS DeepAR.
import numpy as np

def pinball(y, q, tau):
    d = y - q
    return np.mean(np.maximum(tau * d, (tau - 1) * d))
🐍 Exercise 1: scoring probabilistic forecasts
Implement the pinball loss and three estimates of the CRPS, verify them on standard normal data, and use PIT histograms to tell a calibrated forecast from a badly spread one.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Coverage alone rewards…
  2. 2. Calibration should be checked…
  3. 3. A Python package for conformal intervals:

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Why the pinball loss finds quantiles. The derivative of E L_τ(Y, q) with respect to q is −τ P(Y > q) + (1 − τ) P(Y ≤ q) = F(q) − τ. It is zero where F(q) = τ, and the loss is convex, so the minimiser is the τ-quantile.

CRPS identities. For a forecast CDF F, CRPS(F, y) = ∫ (F(x) − 1[x ≥ y])² dx = E|X − y| − ½E|X − X′|, and also 2∫₀¹ L_τ(y, F⁻¹(τ)) dτ. For N(μ, σ²) there is a closed form σ[z(2Φ(z) − 1) + 2φ(z) − 1/√π] with z = (y − μ)/σ. Its average over y from the same distribution is σ/√π. In Exercise 1 the samples and the 19 quantiles gave 0.55 and 0.59 against the exact 0.56.

Conformal guarantee. If the calibration residuals and the new one are exchangeable, the rank of the new one is uniform. Using the ⌈(n + 1)(1 − α)⌉-th smallest calibration residual then covers with probability at least 1 − α, for any distribution. The guarantee is marginal: it says nothing about coverage in calm or volatile periods, and volatility clustering weakens exchangeability.

📝 Quick check (Level 3)
0/3 answered
  1. 1. The derivative of the expected pinball loss is…
  2. 2. Average CRPS of a correct N(0, σ²) forecast:
  3. 3. The conformal guarantee is…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

On a series whose volatility comes in bursts, which method gives calibrated and sharp 1-step forecasts: a constant-spread Gaussian, split conformal, quantile regression with a volatility feature, or conformal scaled by that feature?

History.

  • R. Koenker and G. Bassett (1978) introduced quantile regression; J. E. Matheson and R. L. Winkler (1976) and T. Gneiting and A. Raftery (2007) developed proper scoring rules including the CRPS.
  • T. Gneiting, F. Balabdaoui and A. Raftery (2007) framed the goal as maximising sharpness subject to calibration.
  • V. Vovk and colleagues developed conformal prediction (2005); Y. Romano, E. Patterson and E. Candès (2019) combined it with quantile regression.
  • D. Salinas et al. (2020) introduced DeepAR, a probabilistic RNN forecaster.

Exercise 2.

  • Simulate an AR(1) with coefficient 0.7 whose shocks have GARCH(1,1) volatility (σ²_t = 0.05 + 0.25e²_t−1 + 0.7σ²_t−1) and Student-t shocks with 5 degrees of freedom.
  • Fit on 2000 points, calibrate on the next 1000 and test on the following 3000.
  • The volatility feature is the mean absolute change over the last 10 steps.
  • Each method forecasts 19 quantiles (levels 0.05 to 0.95). The 90% interval is from the 0.05 to the 0.95 quantile; the CRPS is approximated from the 19 quantiles.

Seed 0:

method 90% coverage coverage, most volatile third mean width CRPS
Gaussian, constant sd 0.924 0.857 2.45 0.395
split conformal 0.939 0.881 2.65 0.391
quantile regression 0.893 0.885 2.12 0.385
scaled conformal 0.897 0.940 2.35 0.388
  • Quantile regression was calibrated both overall and in volatile periods, gave the narrowest intervals and the lowest CRPS in seed 0. Its CRPS was lowest in all three seeds.
  • The constant-spread Gaussian over-covered overall (heavy-tailed shocks inflate the standard deviation) yet under-covered when volatile.
  • Split conformal’s overall coverage depended on the calibration stretch: 0.94, 0.92 and 0.88 in the three seeds, because volatility clustering breaks exchangeability.
  • Scaled conformal was calibrated overall but over-covered in volatile periods (0.94–0.95).
  • The CRPS differences were small, about 3–7% between best and worst; coverage by condition shows the differences far more clearly.
  • Seeds 1 and 2: quantile regression coverage 0.902 and 0.894 (volatile third 0.903 and 0.883); Gaussian 0.941 and 0.947 (volatile third 0.873 and 0.877).
🐍 Exercise 2 (research): on a series whose volatility comes in bursts, which method gives calibrated and sharp 1-step forecasts: a constant-spread Gaussian, split conformal, quantile regression with a volatility feature, or conformal scaled by that feature?
Simulate an AR(1) with GARCH volatility and t shocks, and compare 19-quantile forecasts from a Gaussian, split conformal, quantile regression with a volatility feature and scaled conformal by coverage overall and in volatile periods, width and CRPS.

Probabilistic forecasting in practice

  • Distributional deep models: DeepAR and its successors output distribution parameters; foundation models such as Chronos output samples.
  • Conformal methods for time series: adaptive conformal inference (Gibbs and Candès, 2021) updates the level online to keep long-run coverage under shift.
  • Decisions: inventory, energy trading and capacity planning use quantiles directly (for example, stock to the 95% quantile of demand).
  • Evaluation: report CRPS or weighted quantile loss together with coverage and width, and look at PIT histograms.

References

  1. T. Gneiting and A. E. Raftery (2007). “Strictly proper scoring rules, prediction, and estimation.” Journal of the American Statistical Association.
  2. T. Gneiting, F. Balabdaoui and A. E. Raftery (2007). “Probabilistic forecasts, calibration and sharpness.” Journal of the Royal Statistical Society B.
  3. R. Koenker and G. Bassett (1978). “Regression quantiles.” Econometrica.
  4. Y. Romano, E. Patterson and E. Candès (2019). “Conformalized quantile regression.” NeurIPS.
  5. D. Salinas, V. Flunkert, J. Gasthaus and T. Januschowski (2020). “DeepAR: probabilistic forecasting with autoregressive recurrent networks.” International Journal of Forecasting.