kupiec {segMGarch}R Documentation

Method to backtest VaR violation using the Kupiec statistics

Description

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

LRPoF=2log((1α)Tnfαnf(1nfT)Tnf(nfT)nf)LR_{PoF}= -2 \log\left(\frac{(1-\alpha)^{T-n_f}\alpha^{n_f}} {\left(1-\frac{n_f}{T}\right)^{T-n_f}\left(\frac{n_f}{T}\right)^{n_f}}\right)

LRTFF=2log(α(1α)tf1(1tf)(11tf)tf1),LR_{TFF}= -2 \log\left (\frac{\alpha(1-\alpha)^{t_f -1}} {\left ( \frac{1}{t_f}\right )\left ( 1- \frac{1}{t_f}\right )^{t_f-1}}\right),

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.

Usage

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.

References

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

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")

[Package segMGarch version 1.2 Index]