Type: | Package |
Title: | Expected Shortfall Backtesting |
Version: | 0.3.1 |
Date: | 2023-09-02 |
Description: | Implementations of the expected shortfall backtests of Bayer and Dimitriadis (2020) <doi:10.1093/jjfinec/nbaa013> as well as other well known backtests from the literature. Can be used to assess the correctness of forecasts of the expected shortfall risk measure which is e.g. used in the banking and finance industry for quantifying the market risk of investments. A special feature of the backtests of Bayer and Dimitriadis (2020) <doi:10.1093/jjfinec/nbaa013> is that they only require forecasts of the expected shortfall, which is in striking contrast to all other existing backtests, making them particularly attractive for practitioners. |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
Depends: | R(≥ 2.10.0) |
Imports: | esreg |
RoxygenNote: | 7.2.3 |
NeedsCompilation: | no |
Packaged: | 2023-09-03 18:58:24 UTC; sebastian |
Author: | Sebastian Bayer [aut, cre], Timo Dimitriadis [aut] |
Maintainer: | Sebastian Bayer <sebastian.bayer@uni-konstanz.de> |
Repository: | CRAN |
Date/Publication: | 2023-09-03 19:10:05 UTC |
esback: A package for backtesting expected shortfall forecasts
Description
The esback package contains functions for backtesting expected shortfall forecasts.
Available backtest functions
Author(s)
Maintainer: Sebastian Bayer sebastian.bayer@uni-konstanz.de
Authors:
Timo Dimitriadis timo.dimitriadis@awi.uni-heidelberg.de
Conditional Calibration Backtest
Description
The simple and general conditional calibration backtests of Nolde & Ziegel (2007).
Usage
cc_backtest(r, q, e, s = NULL, alpha, hommel = TRUE)
Arguments
r |
A vector of returns. |
q |
A vector of Value-at-Risk forecasts. |
e |
A vector of Expected Shortfall forecasts. |
s |
A vector of volatility forecasts. |
alpha |
Scalar probability level in (0, 1). |
hommel |
If TRUE, use Hommels correction, otherwise use the classical Bonferroni correction. |
Value
Returns a list with the following components:
pvalue_twosided_simple
pvalue_onesided_simple
pvalue_twosided_general
pvalue_onesided_general
References
Nolde & Ziegel (2007) doi:10.1214/17-AOAS1041
Examples
data(risk_forecasts)
r <- risk_forecasts$r
q <- risk_forecasts$q
e <- risk_forecasts$e
s <- risk_forecasts$s
cc_backtest(r = r, q = q, e = e, s = s, alpha = 0.025)
Exceedance Residuals Backtest
Description
Tests whether the mean of the exceedance residuals, respectively the mean of the standardized exceedance residuals is zero.
Usage
er_backtest(r, q, e, s = NULL, B = 1000)
Arguments
r |
A vector of returns. |
q |
A vector of Value-at-Risk forecasts. |
e |
A vector of Expected Shortfall forecasts. |
s |
A vector of volatility forecasts. |
B |
Number of bootstrap iterations |
Value
Returns a list with the following components:
pvalue_twosided_simple
pvalue_onesided_simple
pvalue_twosided_standardized
pvalue_onesided_standardized
References
McNeil & Frey (2000) doi:10.1016/S0927-5398(00)00012-8
Examples
data(risk_forecasts)
r <- risk_forecasts$r
q <- risk_forecasts$q
e <- risk_forecasts$e
s <- risk_forecasts$s
er_backtest(r = r, q = q, e = e, s = s)
Expected Shortfall Regression Backtest
Description
This function implements multiple expected shortfall regression (esreg)
based backtests.
Using the version
argument, the following backtests are available:
("Strict ESR") Regresses the returns on the expected shortfall forecasts and tests the ES coefficients for (0, 1).
("Auxiliary ESR") Regresses the returns on the quantile and the expected shortfall forecasts and tests the ES coefficients for (0, 1).
("Strict Intercept") Tests whether the expected shortfall of the forecast error r - e is zero.
Usage
esr_backtest(
r,
q,
e,
alpha,
version,
B = 0,
cov_config = list(sparsity = "nid", sigma_est = "scl_sp", misspec = TRUE)
)
Arguments
r |
A vector of returns. |
q |
A vector of Value-at-Risk forecasts. |
e |
A vector of Expected Shortfall forecasts. |
alpha |
Scalar probability level in (0, 1). |
version |
Version of the backtest to be used |
B |
Number of bootstrap samples. Set to 0 to disable bootstrapping. |
cov_config |
a list with three components: sparsity, sigma_est, and misspec, see vcovA |
Value
Returns a list with the following components:
pvalue_two_sided_asymptotic
pvalue_one_sided_asymptotic (for version 3)
pvalue_two_sided_bootstrap
pvalue_one_sided_bootstrap (for version 3)
References
Bayer & Dimitriadis (2020) doi:10.1093/jjfinec/nbaa013
Examples
data(risk_forecasts)
r <- risk_forecasts$r
q <- risk_forecasts$q
e <- risk_forecasts$e
esr_backtest(r = r, q = q, e = e, alpha = 0.025, version = 1)
Parameter Definitions
Description
Defines commonly used parameters.
Usage
parameter_definition(r, q, e, s, alpha, B)
Arguments
r |
A vector of returns. |
q |
A vector of Value-at-Risk forecasts. |
e |
A vector of Expected Shortfall forecasts. |
s |
A vector of volatility forecasts. |
alpha |
Scalar probability level in (0, 1). |
B |
Number of bootstrap samples. Set to 0 to disable bootstrapping. |
Returns and risk forecasts for the S&P 500 index
Description
A dataset containing the daily log returns and risk forecasts for the S&P 500 index. The quantile and expected shortfall forecasts are for the probability level 2.5%.
Usage
data(risk_forecasts)
Format
A data.frame with 4396 rows and 4 variables
Details
Description of the variables:
- r
Daily log returns from January 3, 2000 to September 29, 2017 (4465 days)
- q
Value-at-Risk forecasts of the Historical Simulation approach
- e
Expected shortfall forecasts of the Historical Simulation approach
- s
Volatility forecasts of the Historical Simulation approach