lossfun | R Documentation |
This functions allows for the calculation of loss functions in order to assess the performance of models in regard to forecasting ES.
lossfun(obj = list(loss = NULL, ES = NULL), beta = 1e-04)
obj |
a list that contains the following elements:
Please note that a list returned by the |
beta |
a single numeric value; a measure for the opportunity cost of
capital; default is |
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.
an S3 class object, which is a list of
regulatory loss function
firm's loss function following Sarma et al. (2003)
loss function following Abad et al. (2015)
Feng's loss function; a compromise of regulatory and firm's loss function
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.