Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


RMOPI (version 1.1)

VaRSimTest: VaR Calculation and Coverage Test

Description

Calculate VaR with three method and implement unconditional and conditional coverage test.

Usage

VaRSimTest(data, method, alpha, fun, ...)

Value

A list of VaR and coverage test outcome

Arguments

data

vector of returns

method

the VaR method, one of "param", "hist" and "mc"

alpha

the VaR confidence level

fun

function calculating VaR, limited by method

...

the extra parameters of fun

References

Christoffersen P. F. 1998. "Evaluating Interval Forecasts", International Economic Review, 841-862. doi: 10.2307/2527341.

Kupiec PH. 1995. "Techniques for Verifying the Accuracy of Risk Measurement Models", The Journal of Derivatives, 3(2), 73-84. doi: 10.3905/jod.1995.407942.

Examples

Run this code
swan <- rGarch(len = 30)
date <- as.Date("2015-01-01") + days(0:(length(swan) - 1))
tswan <- tibble(garch = swan, date = date)
tsswan <- as.xts(swan, date)
alpha = 0.05
num = 100000
mu = mean(tsswan)
sd = sd(tsswan)
VaRSimTest(tsswan, "mc", alpha , rnorm, 100000, mu, sd)

Run the code above in your browser using DataLab