kupiec-methods: Method to backtest VaR violation using the Kupiec statistics

Description Usage Arguments References Examples

Description

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

LR_{PoF}= -2 \log≤ft(\frac{(1-α)^{T-n_f}α^{n_f}} {≤ft(1-\frac{n_f}{T}\right)^{T-n_f}≤ft(\frac{n_f}{T}\right)^{n_f}}\right)

LR_{TFF}= -2 \log≤ft (\frac{α(1-α)^{t_f -1}} {≤ft ( \frac{1}{t_f}\right )≤ft ( 1- \frac{1}{t_f}\right )^{t_f-1}}\right),

where n_f denotes the number of failures occurred and t_f the number of days until the first failure within the n observations. Under H_0, both LR_{PoF} and LR_{TFF} are asymptotically χ^2_1-distributed, and their exceedance of the critical value implies that the VaR model is inadequate.

Usage

1
2
3
4
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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")

Example output



segMGarch documentation built on May 2, 2019, 7:23 a.m.