kupiec-methods function

Method to backtest VaR violation using the Kupiec statistics

Method to backtest VaR violation using the Kupiec statistics

An S4 method that performs backtest for VaR models using the Kupiec statistics. For a sample of nn observations, the Kupiec test statistics takes the form of likelihood ratio

c("LRPoF=2logleft(frac(1alpha)Tnfalphanf\nLR_{PoF}= -2 \\log\\left(\\frac{(1-\\alpha)^{T-n_f}\\alpha^{n_f}}\n", "left(1fracnfTright)Tnfleft(fracnfTright)nfright) {\\left(1-\\frac{n_f}{T}\\right)^{T-n_f}\\left(\\frac{n_f}{T}\\right)^{n_f}}\\right)")

c("LRTFF=2logleft\nLR_{TFF}= -2 \\log\\left\n", " (\\frac{\\alpha(1-\\alpha)^{t_f -1}} {\\left ( \\frac{1}{t_f}\\right\n", " )\\left ( 1- \\frac{1}{t_f}\\right )^{t_f-1}}\\right),\n")

where nfn_f denotes the number of failures occurred and tft_f the number of days until the first failure within the nn

observations. Under H0H_0, both LRPoFLR_{PoF} and LRTFFLR_{TFF} are asymptotically χ12\chi^2_1-distributed, and their exceedance of the critical value implies that the VaR model is inadequate. methods

kupiec(y, VaR, VaR_level, verbose = TRUE, test = "PoF") ## S4 method for signature 'ANY' kupiec(y, VaR, VaR_level, verbose = TRUE, test = "PoF")

Arguments

  • y: The time series to apply a VaR model (a single asset rerurn or portfolio return).
  • VaR: The forecast VaR.
  • VaR_level: The VaR level, typically 95% or 99%.
  • verbose: If TRUE show the outcome. Default is TRUE.
  • test: Choose between PoF or TFF. Default is PoF.

Examples

pw.CCC.obj = new("simMGarch") pw.CCC.obj@d = 10 pw.CCC.obj@n = 1000 pw.CCC.obj@changepoints = c(250,750) pw.CCC.obj = pc_cccsim(pw.CCC.obj) y_out_of_sample = t(pw.CCC.obj@y[,900:1000]) w=rep(1/pw.CCC.obj@d,pw.CCC.obj@d) #an equally weighted portfolio #VaR = quantile(t(pw.CCC.obj@y[,1:899])%*%w,0.05) #ts.plot(y_out_of_sample%*%w,ylab="portfolio return");abline(h=VaR,col="red") #kupiec(y_out_of_sample%*%w,rep(VaR,100),.95,verbose=TRUE,test="PoF")

References

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

  • Maintainer: Karolos Korkas
  • License: GPL (>= 2)
  • Last published: 2019-01-17

Useful links