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 observations,
the Kupiec test statistics takes the form of likelihood ratio
where denotes the number of failures occurred and
the number of days until the first failure within the
observations. Under
, both
and
are asymptotically
-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 |
test |
Choose between PoF or TFF. Default is |
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")