fhs {quarks} | R 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 |
model |
model for estimating conditional volatility; options are |
lambda |
decay factor for the calculation of weights; default is |
nboot |
size of bootstrap sample; must be a single non-NA integer value
with |
... |
additional arguments of the
|
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"
(seerugarch
documentation) and'EWMA'
formodel = "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