lossfun: Loss Functions In quarks: Simple Methods for Calculating and Backtesting Value at Risk and Expected Shortfall

 lossfun R Documentation

Loss Functions

Description

This functions allows for the calculation of loss functions in order to assess the performance of models in regard to forecasting ES.

Usage

```lossfun(obj = list(loss = NULL, ES = NULL), beta = 1e-04)
```

Arguments

 `obj` a list that contains the following elements: `loss`a numeric vector that contains the values of a loss series ordered from past to present; is set to `NULL` by default `ES`a numeric vector that contains the estimated values of the ES for the same time points of the loss series `loss`; is set to `NULL` by default Please note that a list returned by the `rollcast` function can be directly passed to `lossfun`. `beta` a single numeric value; a measure for the opportunity cost of capital; default is `1e-04`.

Details

Given a negative return series `obj\$loss`, the corresponding Expected Shortfall (ES) estimates `obj\$ES` and a parameter `beta` that defines the opportunity cost of capital, four different definitions of loss functions are considered.

Value

an S3 class object, which is a list of

loss.fun1

regulatory loss function

loss.fun2

firm's loss function following Sarma et al. (2003)

loss.fun3

loss function following Abad et al. (2015)

loss.fun4

Feng's loss function; a compromise of regulatory and firm's loss function

References

Abad, P., Muela, S. B., & MartÃ­n, C. L. (2015). The role of the loss function in value-at-risk comparisons. The Journal of Risk Model Validation, 9(1), 1-19.

Sarma, M., Thomas, S., & Shah, A. (2003). Selection of Value-at-Risk models. Journal of Forecasting, 22(4), 337-358.

Examples

```
prices <- DAX\$price.close
returns <- diff(log(prices))
n <- length(returns)
nout <- 250 # number of obs. for out-of-sample forecasting
nwin <- 500 # window size for rolling forecasts
results <- rollcast(x = returns, p = 0.975, method = 'age', nout = nout,
nwin = nwin)
loss <- -results\$xout
ES <- results\$ES
loss.data <- list(loss = loss, ES = ES)
lossfun(loss.data)

# directly passing the output object of 'rollcast()' to 'lossfun()'
lossfun(results)

```

quarks documentation built on Sept. 1, 2022, 1:06 a.m.