Day 123 — Backtesting a risk model: coverage and independence

Monday, 7 December 2026 · Week 18 of 52 · Portfolios and risk · Study day · 65 min

A risk model that is never tested is a number generator, and the two tests that matter check different failures, one of which almost every model fails.

What you should be able to do tonight

  • Run an unconditional coverage test on your VaR exceedances and report the p-value.
  • Run an independence test on the same exceedances and say what a rejection tells you about the volatility model behind it.

Tasks 65 min

35 min Implement both tests: the unconditional coverage likelihood ratio on the exceedance count, and the independence test on whether an exceedance predicts the next one. Run them on your three VaR estimators. The historical simulation version usually passes the first and fails the second.

20 min Diagnose the failure: exceedance clustering means the model is not tracking conditional volatility, which is exactly what filtered historical simulation was built to fix. Confirm that the filtered version passes the independence test where the plain historical one does not.

10 min Add the two tests to qlib/risk.py so that any risk model you build later is checkable with one call.

The running strategy

qlib/risk.py can now test a risk model rather than only produce one, with coverage and independence tests that any later model has to pass before its numbers are used for sizing.

Resources

Deliverable

Coverage and independence tests in qlib/risk.py, run on three VaR estimators with p-values reported.

Checkpoint

Your VaR has the right number of exceedances and they cluster in March 2020. Which test caught it, and what is the fix?

Prepare for tomorrow

Ten minutes tonight so Day 124, Tuesday, 8 December 2026 starts clean. This is what the evening email sends you.

Pick three historical episodes: October 2008, March 2020, and one you choose. Note the dates.

Extract your book’s actual or simulated returns over each window.

Write down what you think the worst one did to it, before you look.