Skip to contents

Provides a simple binomial backtest for a Value at Risk (VaR) model.

This function performs a Kupiec Proportion of Failures (POF) test to evaluate whether the number of times returns breached the VaR threshold matches the expected frequency 1-p.

The original implementation was provided in the archived VaR package by Talgat Daniyarov.

Usage

VaR.backtest(R, VaR, p = 0.95)

Arguments

R

an xts, vector, matrix, data frame, timeSeries or zoo object of actual asset returns

VaR

estimated Value at Risk scalar or vector corresponding to the same periods

p

confidence level for calculation, default p=.95

Value

A list containing:

  • expected_exceedances the expected number of VaR breaches.

  • actual_exceedances the number of actual VaR breaches.

  • p.value the p-value from the binomial proportion test.

References

Daniyarov, T. VaR: Value at Risk estimation. CRAN Archive. 2004. https://cran.r-project.org/src/contrib/Archive/VaR/

See also

Author

Brian G. Peterson, Talgat Daniyarov

Examples


data(edhec)
# calculate VaR at 95 percent confidence
v <- as.numeric(VaR(edhec[, 1], p = 0.95, method = "historical"))

# evaluate the backtest
VaR.backtest(edhec[, 1], v, p = 0.95)
#> $expected_exceedances
#> [1] 14.65
#> 
#> $actual_exceedances
#> [1] 15
#> 
#> $p.value
#> [1] 1
#>