tl

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

Syntax

``TestResults = tl(vbt)``

Description

example

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

Examples

collapse all

Create a `varbacktest` object.

```load VaRBacktestData vbt = varbacktest(EquityIndex,Normal95)```
```vbt = varbacktest with properties: PortfolioData: [1043x1 double] VaRData: [1043x1 double] PortfolioID: "Portfolio" VaRID: "VaR" VaRLevel: 0.9500 ```

Generate the `tl` test results.

`TestResults = tl(vbt)`
```TestResults=1×9 table PortfolioID VaRID VaRLevel TL Probability TypeI Increase Observations Failures ___________ _____ ________ _____ ___________ _______ ________ ____________ ________ "Portfolio" "VaR" 0.95 green 0.77913 0.26396 0 1043 57 ```

Use the `varbacktest` constructor with name-value pair arguments to create a `varbacktest` object.

```load VaRBacktestData vbt = varbacktest(EquityIndex,... [Normal95 Normal99 Historical95 Historical99 EWMA95 EWMA99],... 'PortfolioID','Equity',... 'VaRID',{'Normal95' 'Normal99' 'Historical95' 'Historical99' 'EWMA95' 'EWMA99'},... 'VaRLevel',[0.95 0.99 0.95 0.99 0.95 0.99])```
```vbt = varbacktest with properties: PortfolioData: [1043x1 double] VaRData: [1043x6 double] PortfolioID: "Equity" VaRID: [1x6 string] VaRLevel: [0.9500 0.9900 0.9500 0.9900 0.9500 0.9900] ```

Generate the `tl` test results.

`TestResults = tl(vbt)`
```TestResults=6×9 table PortfolioID VaRID VaRLevel TL Probability TypeI Increase Observations Failures ___________ ______________ ________ ______ ___________ _________ ________ ____________ ________ "Equity" "Normal95" 0.95 green 0.77913 0.26396 0 1043 57 "Equity" "Normal99" 0.99 yellow 0.97991 0.03686 0.26582 1043 17 "Equity" "Historical95" 0.95 green 0.85155 0.18232 0 1043 59 "Equity" "Historical99" 0.99 green 0.74996 0.35269 0 1043 12 "Equity" "EWMA95" 0.95 green 0.85155 0.18232 0 1043 59 "Equity" "EWMA99" 0.99 yellow 0.99952 0.0011122 0.43511 1043 22 ```

Input Arguments

collapse all

`varbacktest` (`vbt`) object, contains a copy of the given data (the `PortfolioData` and `VarData` properties) and all combinations of portfolio ID, VaR ID, and VaR levels to be tested. For more information on creating a `varbacktest` object, see `varbacktest`.

Output Arguments

collapse all

`tl` test results, returned as a table where the rows correspond to all combinations of portfolio ID, VaR ID, and VaR levels to be tested. The columns correspond to the following information:

• `'PortfolioID'` — Portfolio ID for the given data

• `'VaRID'` — VaR ID for each of the VaR data columns provided

• `'VaRLevel'` — VaR level for the corresponding VaR data column

• `'TL'` — Categorical (ordinal) array with the categories `green`, `yellow`, and `red` that indicate the result of the traffic light `tl` test

• `'Probability'` — Cumulative probability of observing up to the corresponding number of failures

• `'TypeI'` — Probability of observing the corresponding number of failures or more if the model is correct

• `'Increase'` — Increase in the scaling factor

• `'Observations'` — Number of observations

• `'Failures'` — Number of failures

collapse all

Traffic Light Test

The `tl` function performs Basel's traffic light test, also known as three-zone test. Basel’s methodology can be applied to any number of time periods and VaR confidence levels, as explained in Algorithms.

The Basel Committee reports, as an example, a table of the three zones for 250 time periods and a VaR confidence level of 0.99. The increase in scaling factor in the table reported by Basel has some ad-hoc adjustments (rounding, and so on) not explicitly described in the Basel document. The following table compares the increase in scaling factor reported in the Basel document for the case of 250 periods and 0.99% VaR confidence level, and the increase in the factors reported by the TL test.

FailuresZoneIncrease BaselIncrease TL
0Green00
1Green00
2Green00
3Green00
4Green00
5Yellow0.400.3982
6Yellow0.500.5295
7Yellow0.650.6520
8Yellow0.750.7680
9Yellow0.850.8791
10Red11

The `tl` function computes the scaling factor following the methodology described in the Basel document (see References) and is explained in the Algorithms section. The `tl` function does not apply any ad-hoc adjustments.

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\left(X\le x|N,p\right)=F\left(x|N,p\right)$`

where $F\left(x|N,p\right)$ 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\left(x|N,p\right)$`0.95`

• Yellow: `0.95` < $F\left(x|N,p\right)$`0.9999`

• Red: `0.9999` < $F\left(x|N,p\right)$

The probability of a Type-I error, reported in the `'TypeI'` column, is $TypeI=TypeI\left(x|N,p\right)=1-F\left(X\ge x|N,p\right)$.

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 andx 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×\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.

Introduced in R2016b