trafftest | R Documentation |

Backtesting methods, most importantly traffic light tests, are applied to previously calculated Value-at-Risk and Expected Shortfall series.

```
trafftest(obj)
```

`obj` |
A list returned by the |

The Traffic Light Test for backtesting the Value-at-Risk (VaR) was proposed by the Basel Committee on Banking Supervision (1996). A formal mathematical description was given by Constanzino and Curran (2018). Following Constanzino and Curran (2018), define the Value-at-Risk breach indicator by

`X_{VaR}^{(i)}(\alpha) = 1_{ \{L_i \geq VaR_i(\alpha)\} },`

where `i`

defines the corresponding trading day, `L_i`

is the loss
(denoted as a positive value) on day `i`

and `\alpha`

is the confidence
level of the VaR (e.g. if `\alpha = 0.95`

, the 95%-VaR is considered). The
total number of breaches over all trading days `i = 1, 2, ..., N`

is then
given by

`X_{VaR}^{N}(\alpha) = \sum_{i=1}^{N} 1_{\{L_i \geq VaR_i(\alpha)\}}.`

Following a Binomial Distribution, the cumulative probabilities of observing
a specific number of breaches or less can be computed. Under the hypothesis
that the selected volatility model is true, the cumulative probability of
observing `X_{VaR}^N (\alpha)`

breaches is therefore easily obtainable. The
Basel Committee on Banking Supervision (1996) defined three zones. Depending
on the zone the calculated cumulative probability can be sorted into, the
suitability of the selected model can be assessed. Models with calculated
cumulative probabilities < 95% belong to the green zone and are considered
appropriate. Furthermore, if the probabilities are greater or equal to 95%
but smaller than 99.99%, the corresponding models are categorized into the
yellow zone. The red zone is for models with cumulative probabilities greater
or equal to 99.99%. If the test results in a yellow zone classification, the
respective VaR values require additional monitoring. Moreover, the Basel
Committee recommended to consider additional capital requirements of a bank,
if its model used is in the yellow zone. Models in the red zone are
considered to be heavily flawed.

Based on the same three-zone approach with the same zone boundaries, Constanzino and Curran (2018) proposed a traffic light test for the Expected Shortfall (ES). The total severity of breaches is given by

```
X_{ES}^N(\alpha) = \sum_{i=1}^N(1 - (1 - F(L_i))/(1 - \alpha))
* 1_{\{L_i \geq VaR_i(\alpha)\}},
```

with `F(L_i)`

being the cumulative distribution of the loss at day `i`

. As stated
by Constanzino and Curran (2018), `X_{ES}^N(\alpha)`

is approximately normally
distributed `\mathcal{N}(\mu_{ES}`

, `N \sigma_{ES}^2)`

for large samples, where
`\mu_{ES} = 0.5(1 - \alpha)N`

and
`\sigma_{ES}^2 = (1 - \alpha)(4 - 3(1 - \alpha)) / 12`

, from which cumulative
probabilities for the observed breaches `X_{ES}^N`

can be easily obtained.

For semiparametric models, the backtesting of the VaR is analogous to the
described approach. Backtesting the ES, however, requires minor adjustments.
Given that the model's underlying innovations follow a standardized
t-distribution with degrees of freedom `\nu`

, define by `r_t`

the demeaned
returns and by `\hat{s}_t`

the estimated total volatility.

`\hat{\epsilon}_t^* = -r_t / \hat{s}_t \sqrt{\nu / (\nu - 2)}`

are now suitable to calculate the total severity of breaches under the
assumption that `\epsilon_t^*`

are identically and independently
distributed t-distributed random variables.

This function uses an object returned by the `varcast`

function
of the `ufRisk`

package as an input for the
function argument `obj`

. A list with different elements, such as
the cumulative probabilities for the VaR and ES series within `obj`

,
is returned. Instead of the list, only the traffic light backtesting results
are printed to the R console.

NOTE:

More information on VaR and ES can be found in the documentation of the
`varcast`

function of the `ufRisk`

package
`varcast`

.

A list of class `ufRisk`

is returned with the following elements.

- model
selected model for estimation

- p_VaR.e
cumulative probability of observing the number of breaches or fewer for (1 -

`a.e`

)100%-VaR- p_VaR.v
cumulative probability of observing the number of breaches or fewer for (1 -

`a.v`

)100%-VaR- p_ES
cumulative probability of observing the number of breaches or fewer for (1 -

`a.e`

)100%-ES- pot_VaR.e
number of exceedances for (1 -

`a.e`

)100%-VaR- pot_VaR.v
number of exceedances for (1 -

`a.v`

)100%-VaR- potES
number of exceedances for (1 -

`a.e`

)100%-ES- br.sum
sum of breaches for (1 -

`a.e`

)100%-ES- WAD
weighted absolute deviations - a model selection criterion

- a.v
coverage level for the (1-

`a.v`

)100% VaR- a.e
coverage level for (1-

`a.e`

)100% VaR

Sebastian Letmathe (Scientific Employee) (Department of Economics, Paderborn University),

Dominik Schulz (Scientific Employee) (Department of Economics, Paderborn University),

Basel Committee on Banking Supervision (1996). Supervisory Framework For The Use of Back-Testing in Conjunction With The Internal Models Approach to Market Risk Capital Requirements. Available online: https://www.bis.org/publ/bcbs22.htm (accessed on 23 June 2020).

Constanzino, N., and Curran, M. (2018). A Simple Traffic Light Approach to Backtesting Expected Shortfall. In: Risks 6.1.2.

```
# Example for Walmart Inc. (WMT)
prices = WMT$price.close
output = varcast(prices)
trafftest(output)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.