# pof

Proportion of failures test for value-at-risk (VaR) backtesting

## Syntax

``TestResults = pof(vbt)``
``TestResults = pof(vbt,Name,Value)``

## Description

example

````TestResults = pof(vbt)` generates the proportion of failures (POF) test for value-at-risk (VaR) backtesting.```

example

````TestResults = pof(vbt,Name,Value)` adds an optional name-value pair argument for `TestLevel`.```

## 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 `pof` test results.

`TestResults = pof(vbt,'TestLevel',0.99)`
```TestResults=1×9 table PortfolioID VaRID VaRLevel POF LRatioPOF PValuePOF Observations Failures TestLevel ___________ _____ ________ ______ _________ _________ ____________ ________ _________ "Portfolio" "VaR" 0.95 accept 0.46147 0.49694 1043 57 0.99 ```

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 `pof` test results using the `TestLevel` optional input.

`TestResults = pof(vbt,'TestLevel',0.90)`
```TestResults=6×9 table PortfolioID VaRID VaRLevel POF LRatioPOF PValuePOF Observations Failures TestLevel ___________ ______________ ________ ______ _________ _________ ____________ ________ _________ "Equity" "Normal95" 0.95 accept 0.46147 0.49694 1043 57 0.9 "Equity" "Normal99" 0.99 reject 3.5118 0.060933 1043 17 0.9 "Equity" "Historical95" 0.95 accept 0.91023 0.34005 1043 59 0.9 "Equity" "Historical99" 0.99 accept 0.22768 0.63325 1043 12 0.9 "Equity" "EWMA95" 0.95 accept 0.91023 0.34005 1043 59 0.9 "Equity" "EWMA99" 0.99 reject 9.8298 0.0017171 1043 22 0.9 ```

## 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`.

### Name-Value Pair Arguments

Specify optional comma-separated pairs of `Name,Value` arguments. `Name` is the argument name and `Value` is the corresponding value. `Name` must appear inside quotes. You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

Example: ```TestResults = pof(vbt,'TestLevel',0.99)```

Test confidence level, specified as the comma-separated pair consisting of `'TestLevel'` and a numeric between `0` and `1`.

Data Types: `double`

## Output Arguments

collapse all

`pof` test results, returned as a table where the rows correspond to all combinations of portfolio ID, VaR ID, and VaR level 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

• `'POF'` — Categorical array with the categories `accept` and `reject` that indicate the result of the `pof` test

• `'LRatioPOF'` — Likelihood ratio of the `pof` test

• `'PValuePOF'` — P-value of the `pof` test

• `'Observations'` — Number of observations

• `'Failures'` — Number of failures

• `'TestLevel'` — Test confidence level

Note

For `pof` test results, the terms `accept` and `reject` are used for convenience, technically a `pof` test does not accept a model. Rather, the test fails to reject it.

collapse all

### Proportion of Failures (POF) Test

The `pof` function performs Kupiec's proportion of failures test.

The POF test is a likelihood ratio test proposed by Kupiec (1995) to assess if the proportion of failures (number of failures divided by number of observations) is consistent with the VaR confidence level.

## Algorithms

The likelihood ratio (test statistic) of the `pof` test is given by

`$LRatioPOF=-2\mathrm{log}\left(\frac{{\left(1-pVaR\right)}^{N-x}pVa{R}^{x}}{{\left(1-\frac{x}{N}\right)}^{N-x}{\left(\frac{x}{N}\right)}^{x}}\right)=-2\left[\left(N-x\right)\mathrm{log}\left(\frac{N\left(1-pVaR\right)}{N-x}\right)+x\mathrm{log}\left(\frac{NpVaR}{x}\right)\right]$`

where N is the number of observations, x is the number of failures, and pVaR = 1 − VaRLevel. This test statistic is asymptotically distributed as a chi-square distribution with 1 degree of freedom. By the properties of the logarithm,

and

The p-value of the POF test is the probability that a chi-square distribution with 1 degree of freedom exceeds the likelihood ratio LRatioPOF

`$PValuePOF=1-F\left(LRatioPOF\right)$`

where F is the cumulative distribution of a chi-square variable with 1 degree of freedom.

The result of the test is to accept if

`$PValuePOF`

and reject otherwise, where F is the cumulative distribution of a chi-square variable with 1 degree of freedom.

## References

[1] Kupiec, P. "Techniques for Verifying the Accuracy of Risk Management Models." Journal of Derivatives. Vol. 3, 1995, pp. 73–84.