Bayesian VaR Backtester

Breach rates, Basel zones, and their uncertainty, updated every 25 trading days.

BETA-BINOMIAL · 99% VaR

Prior: Two Previous Backtest Years

Year 1 · two years ago
1.20% breach rate
Year 2 · last year
0.80% breach rate
Prior source & weights Y1 0.40 · Y2 0.50 → 225 pseudo-days

Lower weights make the prior easier to move. Higher weights make it stubborn.

Step Through the Year

After day 150
Pre50100150200250
1 · 25-day breach rate
2 · Year-to-date rate
θ · True breach rate
3 · Bayes forecast: Basel zone at day 250

Clustering Check

The Calculation, Step by Step

    4 · Uncertainty Curve: Breaches at Day 250

    Green 0–4 Yellow 5–9 Red 10+ Preseason Earlier windows Breaches so far

    Zone Forecast Through the Year

    P(green) P(yellow) P(red)

    Breach Rate Trajectory

    25-day rate Year-to-date rate θ estimate 95% credible range 1% claim

    Backtest Log

    Edit any breach count. Click a row to jump to it.
    DaysBreaches25-dayYTDθ̂Zone forecastE (95%)

    8. Things to Try

    • Pick Model's claim (1%) and press Play. The trusting prior raises the alarm later, but it still raises it.
    • Step to day 150. The traffic light still reads green, with 4 breaches, yet the zone forecast already leans yellow.
    • Spread the 6 breaches from days 126–175 evenly across the year (for example, one in each of six windows). The year-end zone stays the same, but the clustering flag goes quiet. Counting alone can't tell those two years apart.
    • Set every current-year window to 0. Even a spotless year moves the estimate only slowly, because breaches are rare events.

    Input rules

    • Breaches and trading days must be whole numbers, with 0 ≤ breaches ≤ days. Each 25-day window allows 0–25 breaches.
    • Each prior year needs at least 1 trading day unless its weight is 0. α₀ and β₀ are floored at 0.5 so the Beta stays valid.
    • Prior years above 260 trading days get a soft warning. That's more than a calendar year of trading.
    • More than 5 breaches in one 25-day window gets a soft warning. That's extreme for a 99% model.
    • VaR confidence is fixed at 99%, and windows at 25 days, because the Basel zones are defined for 250 days at 99%.

    9. Sources & Credits

    Regulatory framework

    • Basle Committee on Banking Supervision (1996), "Supervisory framework for the use of 'backtesting' in conjunction with the internal models approach to market risk capital requirements." The source of the green, yellow, and red zones, the 250-day window, and the plus factors used here. BIS (PDF)
    • Basel Framework, MAR32 and MAR99. The current standard. It keeps the 250-day, 99% count but calls the middle zone "amber," and it applies a different multiplier scale under the Fundamental Review of the Trading Book. MAR32 (PDF) · MAR99 (PDF)

    Backtesting methods

    • Paul H. Kupiec (1995), "Techniques for Verifying the Accuracy of Risk Measurement Models." Journal of Derivatives 3(2): 73–84. The proportion-of-failures test, and the warning that rare tail events are hard to verify. DOI link · Federal Reserve working paper
    • Peter F. Christoffersen (1998), "Evaluating Interval Forecasts." International Economic Review 39(4): 841–862. The independence and conditional-coverage tests discussed in section 6. DOI link

    Notes

    • Illustrative data. The default backtest history is made up and doesn't represent any real bank, desk, or model.
    • No affiliation. This app isn't affiliated with or endorsed by the Basel Committee, the BIS, any supervisor, or any author cited above.
    • Educational use only. It's a teaching tool for Bayesian reasoning, not regulatory, compliance, or capital-planning advice.
    • Code and fonts. All math and charts are original vanilla JavaScript and SVG, with no third-party libraries. The fonts are Inter and JetBrains Mono, used under the SIL Open Font License.