# tl

Traffic light test for value-at-risk (VaR) backtesting

## Syntax

## Description

generates the traffic light (TL) test for value-at-risk (VaR)
backtesting.`TestResults`

= tl(`vbt`

)

## Examples

## Input Arguments

## Output Arguments

## More About

## Algorithms

The traffic light test is based on a binomial distribution. Suppose
`N`

is the number of observations, `p`

= 1 -
`VaRLevel`

is the probability of observing a failure if the model
is correct, and *x* is the number of failures.

The test computes the cumulative probability of observing up to
*x* failures, reported in the `'Probability'`

column,

$$Probability=Probability(X\le x|N,p)=F(x|N,p)$$

where $$F(x|N,p)$$ is the cumulative distribution of a binomial variable with parameters
*N* and *p*, with *p* = 1 -
*VaRLevel*. The three zones are defined based on this cumulative
probability:

Green: $$F(x|N,p)$$ ≤

`0.95`

Yellow:

`0.95`

< $$F(x|N,p)$$ ≤`0.9999`

Red:

`0.9999`

< $$F(x|N,p)$$

The probability of a Type-I error, reported in the `'TypeI'`

column, is $$TypeI=TypeI(x|N,p)=1-F(X\ge x|N,p)$$.

This probability corresponds to the probability of mistakenly rejecting the model
if the model were correct. *Probability* and
*TypeI* do not sum up to 1, they exceed 1 by exactly the
probability of having *x* failures.

The increase in scaling factor, reported in the `'Increase'`

column, is always `0`

for the `green`

zone and
always `1`

for the `red`

zone. For the
`yellow`

zone, it is an adjustment based on the relative
difference between the assumed VaR confidence level (*VaRLevel*)
and the observed confidence level (*x* / *N*),
where `N`

is the number of observations and*x* is
the number of failures. To find the increase under the assumption of a normal
distribution, compute the critical values *zAssumed* and
*zObserved*.

The increase to the baseline scaling factor is given by

$$Increase=Baseline\times \left(\frac{zAssumed}{zObserved}-1\right)$$

with the restriction that the increase cannot be negative or greater than
`1`

. The baseline scaling factor in the Basel rules is
3.

The `tl`

function computes the scaling factor following this
methodology, which is also described in the Basel document (see References). The
`tl`

function does not apply any ad-hoc adjustments.

## References

[1] Basel Committee on Banking Supervision, *Supervisory Framework
for the Use of 'Backtesting' in Conjunction with the Internal Models Approach to
Market Risk Capital Requirements.* January, 1996, https://www.bis.org/publ/bcbs22.htm.

## Version History

**Introduced in R2016b**