Skip to main content
aifinhub

Worked example

Running the shipped var-backtest-kupiec-christoffersen engine on the input below produces exactly this output. Continuous integration recomputes it against the engine bundle on every build, so these numbers cannot drift from the code.

Input508 lines

{
  "tool": "var-backtest-kupiec-christoffersen",
  "confidence_level": 0.95,
  "pnl": [
    -22727.98,
    -31722.79,
    -39252.11,
    -2545.31,
    -25908.73,
    8117.41,
    22054.31,
    2684.17,
    -10043.49,
    -9248.59,
    -5033.9,
    7915.21,
    -16028.18,
    -6642.27,
    -10882.29,
    6545.26,
    -20207.63,
    13863.39,
    1277.27,
    25174.3,
    1272.43,
    11381.25,
    23129.64,
    679.8,
    -23705.84,
    11288.09,
    4912.8,
    17981.04,
    -9317.42,
    -18807.42,
    724.51,
    3117.39,
    -10308.82,
    -2439.71,
    -10294.99,
    -13841.85,
    7537.28,
    -24667.29,
    -7972.95,
    18369.52,
    1916.03,
    -2807.87,
    2101.23,
    297.47,
    7216.89,
    -18172.68,
    18404.85,
    -5246.56,
    -9030.1,
    -96.43,
    19052.25,
    -5840.97,
    18667.75,
    -15739.09,
    -4300.5,
    761.11,
    10001.56,
    -11291.4,
    5030.78,
    12577.04,
    21829.4,
    -18573.94,
    190.96,
    -6542.46,
    3285.48,
    27574.68,
    942.26,
    -10018.91,
    12018.48,
    11924.86,
    -15078.72,
    8876.8,
    10257.32,
    7049.62,
    7643.52,
    -3587.1,
    2001.67,
    14051.82,
    25721.07,
    -9717.35,
    6890.51,
    13470.78,
    -4013.68,
    -4591.9,
    17414.99,
    5779.38,
    24056.94,
    915.43,
    -8484.14,
    -11923.81,
    -16493.06,
    -6173.74,
    -7546.58,
    -6648.91,
    -23079.08,
    -17590.9,
    -10144.84,
    8909.34,
    -12612.92,
    -15354.25,
    5950.48,
    13256.57,
    -11324.47,
    -14644.14,
    -2679.5,
    17205.72,
    -220.79,
    16104.88,
    -5538.37,
    10864.91,
    9808.42,
    8910.86,
    -10681.77,
    -6217.45,
    15599.1,
    -9110.72,
    4793.89,
    3646.07,
    3538.42,
    -5308.52,
    -37673.83,
    23443.8,
    -19850.68,
    -2343.33,
    880.74,
    17232.97,
    -2373.88,
    -17652.71,
    9096.75,
    22927.44,
    2876.1,
    14482.86,
    -19772.37,
    2401.25,
    -1111.12,
    -5424.17,
    1033.22,
    21288.24,
    3276.67,
    -16237.62,
    11934.91,
    -12295.3,
    5606.06,
    4654.85,
    -5561.2,
    3537.28,
    -8580,
    -1651.55,
    7615.67,
    16961.96,
    -16372.53,
    -18141.53,
    3191.49,
    -18603.96,
    18255.16,
    -8319.52,
    -6036.63,
    3905.77,
    16364.8,
    -6484.19,
    -3477.11,
    7354.16,
    -9870.37,
    -5027.01,
    -5134.82,
    19240.39,
    -620.12,
    -5715.93,
    14878.55,
    -13436.73,
    15259.59,
    -8823.06,
    3086.04,
    -2560.28,
    -13141.61,
    6242.12,
    7114.17,
    -6036.64,
    -3043.44,
    2884.93,
    4362.76,
    13523.14,
    -14388.31,
    4565.93,
    -15402.55,
    15547.33,
    -2545.48,
    19091.53,
    9466.2,
    2962.47,
    22014.84,
    -7394.33,
    14645.28,
    1306.47,
    11196.48,
    -5656.97,
    -18357.66,
    -27892.88,
    1592.63,
    3282.69,
    10660.31,
    6351.9,
    -3554.99,
    -20177.02,
    -4198.46,
    -4872.7,
    -15237.81,
    535.12,
    -8141.47,
    -19354.18,
    -15637.06,
    -2636.86,
    4606.17,
    -7642.48,
    -1242.9,
    -29819.41,
    17459.7,
    -15659.75,
    -4110.96,
    -10476.92,
    -1111.13,
    4427.31,
    -12655.08,
    16507.19,
    9936.93,
    -1889.58,
    -2617.89,
    -2015.86,
    -5098.18,
    5653.96,
    8443.86,
    -908.29,
    2344.76,
    -13263.44,
    21269.34,
    -14292.3,
    -911.47,
    -5444.77,
    -17776.27,
    -12637.83,
    17474.71,
    7886.99,
    32493.2,
    27140.31,
    -15228.79,
    171.75,
    -6098.38,
    12540,
    1171.76,
    66.66
  ],
  "var_series": [
    18500,
    18579.98,
    18659.83,
    18739.42,
    18818.64,
    18897.34,
    18975.41,
    19052.71,
    19129.13,
    19204.55,
    19278.84,
    19351.88,
    19423.56,
    19493.76,
    19562.37,
    19629.28,
    19694.39,
    19757.59,
    19818.77,
    19877.84,
    19934.71,
    19989.29,
    20041.48,
    20091.2,
    20138.38,
    20182.94,
    20224.81,
    20263.92,
    20300.2,
    20333.61,
    20364.08,
    20391.57,
    20416.03,
    20437.43,
    20455.73,
    20470.9,
    20482.92,
    20491.76,
    20497.42,
    20499.88,
    20499.15,
    20495.21,
    20488.09,
    20477.78,
    20464.31,
    20447.7,
    20427.97,
    20405.15,
    20379.29,
    20350.42,
    20318.59,
    20283.86,
    20246.27,
    20205.88,
    20162.77,
    20116.99,
    20068.63,
    20017.76,
    19964.46,
    19908.82,
    19850.93,
    19790.87,
    19728.75,
    19664.66,
    19598.71,
    19531,
    19461.65,
    19390.75,
    19318.43,
    19244.8,
    19169.98,
    19094.08,
    19017.24,
    18939.57,
    18861.19,
    18782.24,
    18702.84,
    18623.11,
    18543.18,
    18463.19,
    18383.25,
    18303.5,
    18224.07,
    18145.08,
    18066.65,
    17988.92,
    17912,
    17836.03,
    17761.12,
    17687.39,
    17614.96,
    17543.95,
    17474.46,
    17406.62,
    17340.52,
    17276.28,
    17214,
    17153.78,
    17095.71,
    17039.88,
    16986.4,
    16935.33,
    16886.76,
    16840.78,
    16797.45,
    16756.85,
    16719.03,
    16684.07,
    16652,
    16622.9,
    16596.8,
    16573.74,
    16553.76,
    16536.9,
    16523.18,
    16512.62,
    16505.24,
    16501.05,
    16500.06,
    16502.27,
    16507.67,
    16516.26,
    16528.03,
    16542.95,
    16561,
    16582.15,
    16606.37,
    16633.62,
    16663.86,
    16697.03,
    16733.09,
    16771.98,
    16813.62,
    16857.97,
    16904.95,
    16954.47,
    17006.47,
    17060.86,
    17117.55,
    17176.45,
    17237.47,
    17300.51,
    17365.46,
    17432.24,
    17500.72,
    17570.8,
    17642.36,
    17715.3,
    17789.49,
    17864.82,
    17941.17,
    18018.41,
    18096.42,
    18175.08,
    18254.25,
    18333.82,
    18413.66,
    18493.63,
    18573.61,
    18653.48,
    18733.1,
    18812.35,
    18891.09,
    18969.21,
    19046.59,
    19123.08,
    19198.58,
    19272.97,
    19346.11,
    19417.9,
    19488.23,
    19556.97,
    19624.02,
    19689.27,
    19752.63,
    19813.97,
    19873.22,
    19930.27,
    19985.03,
    20037.41,
    20087.34,
    20134.72,
    20179.49,
    20221.57,
    20260.9,
    20297.42,
    20331.05,
    20361.76,
    20389.49,
    20414.2,
    20435.84,
    20454.39,
    20469.81,
    20482.08,
    20491.17,
    20497.09,
    20499.8,
    20499.32,
    20495.64,
    20488.77,
    20478.72,
    20465.5,
    20449.13,
    20429.65,
    20407.08,
    20381.46,
    20352.83,
    20321.24,
    20286.73,
    20249.36,
    20209.2,
    20166.3,
    20120.73,
    20072.58,
    20021.9,
    19968.79,
    19913.34,
    19855.62,
    19795.73,
    19733.77,
    19669.83,
    19604.03,
    19536.46,
    19467.23,
    19396.45,
    19324.24,
    19250.71,
    19175.98,
    19100.16,
    19023.39,
    18945.78,
    18867.46,
    18788.55,
    18709.17,
    18629.47,
    18549.55,
    18469.56,
    18389.61,
    18309.84,
    18230.38,
    18151.35,
    18072.87,
    17995.08,
    17918.1,
    17842.04,
    17767.04,
    17693.21,
    17620.68,
    17549.55,
    17479.94
  ]
}

Output264 lines

{
  "exceptions": 17,
  "observations": 250,
  "observedRate": 0.068,
  "expectedRate": 0.050000000000000044,
  "kupiecLr": 1.5402866138387878,
  "kupiecPValue": 0.2145752781565129,
  "christoffersenLr": 2.756769729919,
  "christoffersenPValue": 0.09684356168263886,
  "jointLr": 4.297056343757788,
  "jointPValue": 0.11665572866302876,
  "hits": [
    1,
    1,
    1,
    0,
    1,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    1,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    1,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    1,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    1,
    1,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    1,
    0,
    1,
    0,
    0,
    0,
    0,
    1,
    0,
    0,
    0,
    0,
    1,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    1,
    0,
    1,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    1,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    1,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ]
}

Frequently asked questions

What does the VaR Backtest (Kupiec & Christoffersen) methodology page document?
Likelihood-ratio derivations and references for the AI Fin Hub Kupiec POF + Christoffersen Independence + joint conditional-coverage VaR backtest. It states the formulas, assumptions, data sources, limitations, and reproducibility steps behind the VaR Backtest (Kupiec & Christoffersen), in the Finance category.
When was the VaR Backtest (Kupiec & Christoffersen) methodology last reviewed?
This methodology was last reviewed on 2026-05-08. The matching tool is at https://aifinhub.io/var-backtest-kupiec-christoffersen/.
Are the VaR Backtest (Kupiec & Christoffersen) numbers reproducible?
Yes. This page embeds a worked example whose output is the verbatim result of running the shipped var-backtest-kupiec-christoffersen engine on a fixed input; the embedded JSON is recomputed and diffed against the engine in CI, so the numbers cannot drift from the code.

Methodology · Tool · Last updated 2026-05-08

How VaR Backtest (Kupiec & Christoffersen) works

Likelihood-ratio derivations behind the Kupiec POF and Christoffersen independence tests in the VaR Backtest tool.

Hit sequence

For each day t the indicator I_t = 1 if PnL_t < −VaR_t (an exception), else 0. Expected exception rate is α = 1 − confidence.

Kupiec POF (LR_uc)

The proportion-of-failures test compares observed exception rate π̂ = x/n to the theoretical α under H0:

LR_uc = −2 · ln( ((1−α)^(n−x) · α^x) / ((1−π̂)^(n−x) · π̂^x) )
LR_uc ~ χ²₁ under H0

Rejecting H0 means the model under- or over-estimates the unconditional VaR rate.

Christoffersen Independence (LR_ind)

Counts the four transitions:

n00 = #{I_{t-1}=0, I_t=0}
n01 = #{I_{t-1}=0, I_t=1}
n10 = #{I_{t-1}=1, I_t=0}
n11 = #{I_{t-1}=1, I_t=1}

π_01 = n01 / (n00 + n01)
π_11 = n11 / (n10 + n11)
π    = (n01 + n11) / (n00 + n01 + n10 + n11)

LR_ind = −2 · ln( L_independent / L_markov )
       ~ χ²₁ under H0

Rejecting H0 means exceptions cluster in time — typical of GARCH-misspecified models that under-estimate risk in volatile regimes.

Joint Conditional Coverage (LR_cc)

LR_cc = LR_uc + LR_ind ~ χ²₂ under H0

A model can pass POF but fail independence (right average rate, wrong clustering), or vice versa. The joint test catches both.

References

  • Kupiec, P. (1995). "Techniques for Verifying the Accuracy of Risk Measurement Models." Journal of Derivatives 3(2): 73–84. DOI: 10.3905/jod.1995.407942.
  • Christoffersen, P. F. (1998). "Evaluating Interval Forecasts." International Economic Review 39(4): 841–862. DOI: 10.2307/2527341.
  • Jorion, P. (2007). Value at Risk: The New Benchmark for Managing Financial Risk, 3rd ed., McGraw-Hill. ISBN: 978-0-07-146495-6.

Limitations

  • Power is low for n < 250 days; small samples often fail to reject obviously bad models.
  • Christoffersen tests first-order Markov clustering only; higher-order clustering requires alternative tests (e.g. dynamic quantile by Engle-Manganelli).
  • Both tests assume the VaR series is exogenous to the PnL series.

External resources