σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
Time Series skill›Module 5 · Evaluation and practice›Topic 5.1·~50 minAdvanced

Forecast evaluation

Skill positionModule 5 of 5 · Topic 1 of 3
5.1 Forecast evaluation
—Lab score— / 100Total XP—Streak—

Scoring a forecast honestly

A forecast is only worth what it achieves on data it did not see. The honest procedure for time series is walk-forward: fit the model on the past, forecast the next value (or block), record the error, move the window forward and repeat. Never shuffle the observations or split them at random, because a model trained on days after the one it predicts has looked into the future. The forecast error is et=yt−y^te_t=y_t-\hat y_tet​=yt​−y^​t​. The common scores are the mean absolute error, MAE=1n∑∣et∣\mathrm{MAE}=\frac1n\sum|e_t|MAE=n1​∑∣et​∣, and the root mean squared error, RMSE=1n∑et2\mathrm{RMSE}=\sqrt{\frac1n\sum e_t^{2}}RMSE=n1​∑et2​​, which punishes large errors more.

RMSE=1n∑tet2,LQLIKE=σ~t2ht−ln⁡σ~t2ht−1,ROOS2=1−∑(etM)2∑(etB)2,DM=dˉse(dˉ)\mathrm{RMSE}=\sqrt{\frac1n\sum_{t}e_t^{2}},\qquad L_{\mathrm{QLIKE}}=\frac{\tilde\sigma_t^{2}}{h_t}-\ln\frac{\tilde\sigma_t^{2}}{h_t}-1,\qquad R^{2}_{\mathrm{OOS}}=1-\frac{\sum (e^{M}_{t})^{2}}{\sum (e^{B}_{t})^{2}},\qquad \mathrm{DM}=\frac{\bar d}{\mathrm{se}(\bar d)}RMSE=n1​t∑​et2​​,LQLIKE​=ht​σ~t2​​−lnht​σ~t2​​−1,ROOS2​=1−∑(etB​)2∑(etM​)2​,DM=se(dˉ)dˉ​(1)

Variance is never observed, so a volatility forecast hth_tht​ is scored against a proxy σ~t2\tilde\sigma_t^{2}σ~t2​ such as the squared return or the realised variance. Because the proxy is noisy, the loss must be chosen with care: the squared error on variance is dominated by a few large days, while QLIKE, L=σ~2/h−ln⁡(σ~2/h)−1L=\tilde\sigma^{2}/h-\ln(\tilde\sigma^{2}/h)-1L=σ~2/h−ln(σ~2/h)−1, is more robust and charges more for under-predicting variance than for over-predicting it by the same factor. Always compare against a naive benchmark, for example yesterday's value or the historical mean. The out-of-sample ROOS2R^{2}_{\mathrm{OOS}}ROOS2​ compares sums of squared errors: it is positive only when the model beats the benchmark. To decide whether a difference in loss is real or luck, use the Diebold-Mariano statistic: with dtd_tdt​ the loss difference between two models, DM=dˉ/se(dˉ)\mathrm{DM}=\bar d/\mathrm{se}(\bar d)DM=dˉ/se(dˉ) is roughly standard normal, so ∣DM∣>1.96|\mathrm{DM}|>1.96∣DM∣>1.96 is significant at 5%. When the forecasts look several steps ahead, the dtd_tdt​ overlap and the standard error must allow for autocorrelation. Choosing the best of many models on the same test data overstates its skill.

Errors and a variance lossFour forecast errors 1, −2, 0, 31,\,-2,\,0,\,31,−2,0,3 give MAE=6/4=1.5\mathrm{MAE}=6/4=1.5MAE=6/4=1.5 and RMSE=(1+4+0+9)/4=3.5≈1.87\mathrm{RMSE}=\sqrt{(1+4+0+9)/4}=\sqrt{3.5}\approx1.87RMSE=(1+4+0+9)/4​=3.5​≈1.87: the single error of 3 pulls RMSE above MAE. For a volatility forecast, take a proxy variance of 444. Predicting h=2h=2h=2 (half of it) costs 2−ln⁡2−1≈0.312-\ln2-1\approx0.312−ln2−1≈0.31 in QLIKE. Predicting h=8h=8h=8 (twice it) costs 0.5−ln⁡0.5−1≈0.190.5-\ln0.5-1\approx0.190.5−ln0.5−1≈0.19. The same factor of error is punished more when the variance is under-predicted, which is the dangerous direction for risk limits. A model with squared-error sum 808080 against a benchmark's 100100100 has ROOS2=1−80/100=0.20R^{2}_{\mathrm{OOS}}=1-80/100=0.20ROOS2​=1−80/100=0.20.
  • Walk-forward: fit on the past, forecast the next block, move forward; never shuffle time series.
  • QLIKE is robust for variance forecasts and punishes under-prediction more; compare with a naive benchmark.
  • Diebold-Mariano: DM=dˉ/se(dˉ)\mathrm{DM}=\bar d/\mathrm{se}(\bar d)DM=dˉ/se(dˉ) tests whether two forecasts really differ; ∣DM∣>1.96|\mathrm{DM}|>1.96∣DM∣>1.96 is significant.

Lab · what's graded

  • Mean absolute error10 pts
  • Root mean squared error15 pts
  • A QLIKE loss15 pts
  • Out-of-sample R squared15 pts
  • A Diebold-Mariano statistic10 pts
  • Why not shuffle10 pts
  • Match the vocabulary15 pts
  • Beating a naive benchmark10 pts
0/ 8 answered
Tasks
1Numeric answer10 ptsNot answered

Four forecast errors are 1, −2, 0, 31,\,-2,\,0,\,31,−2,0,3. What is the MAE?

mae=mae =mae=accepted: ± 0.01
2Numeric answer15 ptsNot answered

For the same four errors, what is the RMSE? Give it to two decimals.

rmse=rmse =rmse=accepted: ± 0.01
3Numeric answer15 ptsNot answered

The proxy variance is σ~2=4\tilde\sigma^{2}=4σ~2=4 and the forecast is h=2h=2h=2. What is the QLIKE loss σ~2/h−ln⁡(σ~2/h)−1\tilde\sigma^{2}/h-\ln(\tilde\sigma^{2}/h)-1σ~2/h−ln(σ~2/h)−1? Give it to two decimals.

ql=ql =ql=accepted: ± 0.01
4Numeric answer15 ptsNot answered

The model's squared errors sum to 808080 and the benchmark's to 100100100. What is ROOS2=1−80/100R^{2}_{\mathrm{OOS}}=1-80/100ROOS2​=1−80/100?

r2=r2 =r2=accepted: ± 0.005
5Numeric answer10 ptsNot answered

The average loss difference between two models is dˉ=0.5\bar d=0.5dˉ=0.5 with standard error 0.20.20.2. What is DM=dˉ/se(dˉ)\mathrm{DM}=\bar d/\mathrm{se}(\bar d)DM=dˉ/se(dˉ)?

dm=dm =dm=accepted: ± 0.02
6Choice10 ptsNot answered

Why is a random train/test split a bad way to evaluate a time-series forecast?

7Match15 ptsNot answered

Match each term with its meaning.

Pick the partner of each item on the left.

Walk-forward
QLIKE
Diebold-Mariano
Naive benchmark
8Explain in words10 ptsNot answered

In one or two sentences, explain why a forecasting model should always be compared with a naive benchmark such as the last observed value.

Math modeKeyboard or LaTeX inputTask 1 of 8 · Ctrl ⏎ to check

Log in to run your code.

Every lecture is free to read. Create an account or log in to run code, run tests and submit this lab.

  • In-browser IDE with a bash terminal — nothing to install
  • Instant grading, XP and your place on the skill
Create an accountLog in
OR
Continue with GitHub