Docs / nablatensor-risk / com.nablatensor.risk

record

VarBacktest

Coverage tests for a one-day VaR forecast against a realised P&L series: the count of exceptions (a loss worse than the forecast), Kupiec's unconditional proportion-of-failures test, and Christoffersen's independence test plus their combined conditional-coverage statistic.

The reference distributions are chi-square with one and two degrees of freedom, whose survival functions are closed forms — 2 (1 - Phi(sqrt s)) for one degree, exp(-s/2) for two — so no incomplete-gamma routine is needed.

Record components

observations
int
exceptions
int
expectedExceptions
double
kupiecStatistic
double
kupiecPValue
double
christoffersenStatistic
double
christoffersenPValue
double
conditionalCoverageStatistic
double
conditionalCoveragePValue
double

Methods

static VarBacktest of(double[] realisedPnl, double[] varForecast, double alpha)
realisedPnl
realised P&L, one per day (loss is -pnl)
varForecast
the VaR forecast for each day (positive loss numbers, same length)
alpha
the confidence the forecast was made at, e.g. 0.99
static VarBacktest of(double[] realisedPnl, double varForecast, double alpha)

Constant-forecast convenience.

boolean rejectedAt(double significance)

True if the model is rejected at the given significance (e.g. 0.05) by conditional coverage.