Learn R Programming

quarks (version 1.0.4)

vwhs: Volatility weighted historical simulation

Description

Calculates univariate Value at Risk and Expected Shortfall (also called Conditional Value at Risk) by means of volatility weighted historical simulation. Volatility is estimated with an exponentially weighted moving average.

Usage

vwhs(x, p = 0.95, lambda = 0.94)

Arguments

x

a numeric vector of asset returns

p

confidence level for VaR calculation; default is 0.95%

lambda

decay factor for the calculation of weights; default is 0.94

Value

Returns a list with the following elements:

VaR

Calculated Value at Risk

ES

Calculated Expected Shortfall (Conditional Value at Risk)

Examples

Run this code
# NOT RUN {
prices <- DAX30$price.close
returns <- diff(log(prices))
vwhs(x = returns, p = 0.95, lambda = 0.94)
# }

Run the code above in your browser using DataLab