arch.univariate.max_undetectable_understatement

arch.univariate.max_undetectable_understatement(returns: ndarray[tuple[int], dtype[float64]] | Series | list[float], var: ndarray[tuple[int], dtype[float64]] | Series | list[float], p: float = 0.05, size: float = 0.05, tests: Sequence[str] = ('kupiec_pof', 'christoffersen_independence', 'christoffersen_conditional_coverage', 'traffic_light'), ignore_too_few: bool = True, window: int = 250) → MaxUndetectableUnderstatementResult[source]

Maximum undetectable understatement of a VaR series.

A passing backtest only says that a VaR was not rejected. It does not say how close it was. This function finds the largest fraction by which the whole VaR series could have been scaled down, with the same returns, such that it and every smaller scaling down are not rejected by the selected tests.

Parameters:
returns: ndarray[tuple[int], dtype[float64]] | Series | list[float]

Realized returns, a 1-d array of finite numbers.

var: ndarray[tuple[int], dtype[float64]] | Series | list[float]

VaR forecasts as positive losses, a 1-d array of finite, strictly positive numbers. See var_exceptions for the sign convention and for how the inputs are aligned.

p: float = 0.05

The probability of an exception that the VaR is designed for, which is the size of the tail, in the interval (0, 0.5]. It is 0.05 for a 95% VaR and 0.01 for a 99% VaR. The default is 0.05, a 95% VaR, and is used by every selected test, including traffic_light.

size: float = 0.05

The size of the Kupiec and the Christoffersen tests, in (0, 1). The default is 0.05. traffic_light does not use a size, since its zones are already defined at fixed probabilities.

tests: Sequence[str] = ('kupiec_pof', 'christoffersen_independence', 'christoffersen_conditional_coverage', 'traffic_light')

The tests to pass, a subset of "kupiec_pof" [3], "christoffersen_independence" and "christoffersen_conditional_coverage" [2], and "traffic_light" [1]. All four are selected by default.

ignore_too_few: bool = True

If True, the default, the coverage part of a test is set aside when the rate of exceptions is below p, since too few exceptions are not evidence of an understated VaR. kupiec_pof is two-sided, and a VaR with too few exceptions is otherwise rejected for being too conservative, so it is not treated as a failure. For christoffersen_conditional_coverage, the coverage statistic is set to 0 and the independence statistic is compared with the same \(\chi^2_2\) distribution, so a rejection caused by clustered exceptions is still a failure. christoffersen_independence and traffic_light are not affected.

window: int = 250

The window of traffic_light, used only if it is selected. The default is 250.

Returns:

The largest fraction by which var could have been understated, and supporting information.

Return type:

MaxUndetectableUnderstatementResult

Raises:
  • TypeError – If returns or var cannot be converted to numbers, p or size is not a real number, window is not an integer, ignore_too_few is not a bool, or tests is not a sequence of str.

  • ValueError – If returns or var is not valid, as in var_exceptions, var is not strictly positive, p is not in (0, 0.5], size is not in (0, 1), window is not positive, tests is empty or has a value that is not one of the tests listed above, or there are too few observations for a selected test, as in christoffersen_independence or traffic_light.

See also

kupiec_pof

Test of the proportion of exceptions.

christoffersen_independence

Test of the independence of the exceptions.

christoffersen_conditional_coverage

Joint test of coverage and independence.

traffic_light

The Basel zone of the number of exceptions.

Notes

The search is over the proportional scalings \((1-s)\mathrm{VaR}_t\) for \(s\) in \([0, 1]\). An observation becomes an exception at \(s = 1 - (-r_t/\mathrm{VaR}_t)\), so the exception set, and so every selected test, is constant between these breakpoints. The search evaluates the tests once at each distinct breakpoint, which is exact for this family of series and needs no optimizer.

The scan starts at the reported VaR, \(s = 0\), and moves toward larger understatement, stopping at the first scaling that is rejected. The result is the largest \(s\) such that every scaling from 0 to \(s\) passes. The independence test, and so the conditional coverage test, is not monotone in \(s\), so a larger scaling beyond the first rejection can pass again, and is not reported. binding lists the tests that reject at that first rejected scaling.

A test rejects when its p-value is at most size, as in the public tests, and the same rule is used for the reported VaR and for every scaling.

This is a lower bound on what a series that is not a proportional scaling of var could hide. A series that understates the VaR on some days and overstates it on others can produce the same, or a smaller, number of exceptions than a proportional scaling, and so can be harder to detect.

Table 1 of [1] reports how often the traffic light accepts a VaR whose true coverage is lower than stated. This function asks a related question of one realised series: how much lower the VaR could have been before any selected test rejected it.

References