Backtest Value-at-Risk (VaR)

Description

Backtesting Value-at-Risk estimate over a moving window.

Usage

1
2
backtestVaR(R, window = 100, p = 0.95, method = "historical",
  bootstrap = FALSE, replications = 1000, bootParallel = FALSE)

Arguments

R

xts or zoo object of asset returns

window

size of the moving window in the rolling VaR estimate.

p

confidence level for the VaR estimate.

method

method for the VaR calculation. Valid choices are "modified", "guassian", "historical", and "kernel"

bootstrap

TRUE/FALSE use the bootstrap estimate for the VaR calculation, (default FALSE).

replications

number of bootstrap replications.

bootParallel

TRUE/FALSE run the bootstrap in parallel, (default FALSE).

Details

The size of the moving window is set with the window argument. For example, if the window size is 100, periods 1:100 are used to estimate the VaR level for period 101.

Author(s)

Ross Bennett

See Also

VaR, bootVaR

Examples

1
2
3
4
5
6
7
data(crsp_weekly)
R <- largecap_weekly[, 1]
backtest <- backtestVaR(R, window=100, p=0.95, method=c("gaussian", "historical", "modified"))
backtest

head(getVaREstimates(backtest))
head(getVaRViolations(backtest))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.