fhs: Filtered historical simulation

View source: R/fhs.R

fhsR Documentation

Filtered historical simulation

Description

Calculates univariate Value at Risk and Expected Shortfall (Conditional Value at Risk) by means of filtered historical simulation. Volatility can be estimated with an exponentially weighted moving average or a GARCH-type model.

Usage

fhs(x, p = 0.975, model = c("EWMA", "GARCH"), lambda = 0.94, nboot = NULL, ...)

Arguments

x

a numeric vector of asset returns

p

confidence level for VaR calculation; default is 0.975

model

model for estimating conditional volatility; options are 'EWMA' and 'GARCH'; if model = 'GARCH', additional arguments can be adjusted via ...; default is 'EWMA'

lambda

decay factor for the calculation of weights; default is 0.94

nboot

size of bootstrap sample; must be a single non-NA integer value with nboot > 0; default is NULL

...

additional arguments of the ugarchspec function from the rugarch-package; only applied if model = 'GARCH'; default settings for the arguments variance.model and mean.model are:

variance.model = list(model = 'sGARCH', garchOrder = c(1, 1))
mean.model = list(armaOrder = c(0, 0))

Value

Returns a list with the following elements:

VaR

Calculated Value at Risk

ES

Calculated Expected Shortfall (Conditional Value at Risk)

p

Confidence level for VaR calculation

garchmod

The model fit. Is the respective GARCH fit for model = "GARCH" (see rugarch documentation) and 'EWMA' for model = "EWMA"

Examples

prices <- DAX$price_close
returns <- diff(log(prices))
# volatility weighting via EWMA
ewma <- fhs(x = returns, p = 0.975, model = "EWMA", lambda = 0.94,
            nboot = 10000)
ewma
# volatility weighting via GARCH
garch <- fhs(x = returns, p = 0.975, model = "GARCH", variance.model =
list(model = "sGARCH"), nboot = 10000)
garch

quarks documentation built on June 22, 2024, 10:03 a.m.