var.backtest: Backtest Intra-day VaR forecasts

Description Usage Arguments Details Value References See Also Examples

View source: R/intra_var.R

Description

var.backtest function backtests the unbiasedness and the independence hypotheses for the intra-day VaR curve forecasts.

Usage

1
var.backtest(vio, tau, K = NULL)

Arguments

vio

A (grid_point) x (number of observations) matrix drawn from the violation process curves.

tau

The nominal/true quantile of the VaR curves.

K

The maximal lagged autocorrelation considered for the independence test. If it is missing, a default value "K=20" is used.

Details

Given the violation process Z_i^τ(t) at the quantile τ, the function computes P-values of two hypothesis tests: (1) unbiasedness H_0: E(Z_i^τ(t)-τ)=0, for all t \in[0,1], 1≤q i≤q N. The test statistics,
T_N=N|| \bar{Z}(t)-τ||^2 is employed, where ||\cdot || is the L^2 norm, and \bar{Z}(t)=1/N∑_{i=1}^N Z_i(t). (2) independence H_0: Z_i^τ(t) is independent, a portmanteau test statistic in used (Kokoszka et al., 2017),
V_{N,K}=N∑_{h=1}^K||\hat{γ}_{h,Z}||^2,
where K is a pre-set maximum lag length, and the autocovariance function \hat{γ}_{h,Z}(t,s)=\frac{1}{N}∑_{i=1}^{N-h}[Z_i(t)-\bar{Z}_i(t)][Z_{i+h}(s)-\bar{Z}(s)], for ||\cdot || is the L^2 norm, and \bar{Z}(t)=1/N∑_{i=1}^N Z_i(t).

Value

List of generated processes:

unbias: the p-value of the unbiasedness test;

independent: the p-value of the independence test.

References

Rice, G., Wirjanto, T., Zhao, Y. (2020). Forecasting Value at Risk via intra-day return curves. International Journal of Forecasting. <doi:10.1016/j.ijforecast.2019.10.006>.

See Also

var.forecast var.vio

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## Not run: 
# generate discrete evaluations of the FGARCH(1,1) process.
grid_point = 50; N = 200
yd = dgp.fgarch(grid_point, N, "garch")
yd = yd$garch_mat

# extract data-driven basis functions through the truncated FPCA method.
basis_est = basis.est(yd, M=2, "tfpca")$basis

# fit the curve data and the conditional volatility by using a FGARCH(1,1) model with M=1.
fd = fda::Data2fd(argvals=seq(0,1,len=grid_point),y=yd,fda::create.bspline.basis(nbasis=32))
garch11_est = est.fGarch(fd, basis_est[,1])
diag_garch = diagnostic.fGarch(garch11_est, basis_est[,1], yd)

# get the in-sample fitting of conditional variance.
sigma_fit = diag_garch$sigma2[,1:N]
error_fit = diag_garch$eps

# get in-sample intra-day VaR curve by assuming a point-wisely Gaussian distributed error term.
var_obj = var.forecast(yd, sigma_fit, error_fit, quantile_v=0.01, Method="normal")
intra_var = var_obj$intraday_VaR

# get the violation curves.
intra_vio = var.vio(yd,intra_var)

# backtesting the Unbiasedness Hypothesis for the violation curve.
pvalues = var.backtest(vio=intra_vio, tau=0.01, K=10)
pvalues$unbias
pvalues$independent

## End(Not run)

yzhao7322/CurVol documentation built on Sept. 5, 2021, 8:41 p.m.