Class VarBacktest

java.lang.Object
com.quantfinlib.risk.VarBacktest

public final class VarBacktest extends Object
VaR model validation: do the exceptions (losses beyond VaR) occur at the promised rate, and independently?
  • Kupiec POF — likelihood-ratio test that the exception frequency matches 1 - confidence (two-sided: both too many and too few exceptions reject). χ²(1).
  • Christoffersen independence — LR test that exceptions do not cluster (a model that is right on average but wrong in crises fails here). χ²(1).
  • Conditional coverage — the joint test (POF + independence), χ²(2), with the exact p-value e^{-LR/2}.
A p-value below the chosen significance (e.g. 0.05) rejects the model.
  • Method Details

    • test

      public static VarBacktest.VarBacktestResult test(double[] returns, double constantVar, double confidence)
      Backtests a constant VaR (positive loss fraction) against realized returns.
    • test

      public static VarBacktest.VarBacktestResult test(double[] returns, double[] varForecasts, double confidence)
      Parameters:
      returns - realized periodic returns
      varForecasts - VaR forecast for each period as a positive loss fraction, aligned with returns
      confidence - the VaR confidence level (e.g. 0.95, 0.99)