conditional
Conditional expected shortfall (ES) backtest by Acerbi and Szekely
Description
runs the conditional ES backtest of Acerbi-Szekely (2014). The conditional test
has two underlying tests, a preliminary Value-at-Risk (VaR) backtest that is
specified using the name-value pair argument TestResults
= conditional(ebts
)VaRTest
, and
the standalone conditional ES backtest. A 'reject'
result on
either underlying test produces a 'reject'
result on the
conditional test.
[
adds optional name-value pair arguments for TestResults
,SimTestStatistic
] = conditional(ebts
,Name,Value
)TestLevel
and
VaRTest
.
Examples
Run an ES Conditional Test
Create an esbacktestbysim
object.
load ESBacktestBySimData rng('default'); % for reproducibility ebts = esbacktestbysim(Returns,VaR,ES,"t",... 'DegreesOfFreedom',10,... 'Location',Mu,... 'Scale',Sigma,... 'PortfolioID',"S&P",... 'VaRID',["t(10) 95%","t(10) 97.5%","t(10) 99%"],... 'VaRLevel',VaRLevel);
Generate the ES conditional test report.
TestResults = conditional(ebts)
TestResults=3×14 table
PortfolioID VaRID VaRLevel Conditional ConditionalOnly PValue TestStatistic CriticalValue VaRTest VaRTestResult VaRTestPValue Observations Scenarios TestLevel
___________ _____________ ________ ___________ _______________ ______ _____________ _____________ _______ _____________ _____________ ____________ _________ _________
"S&P" "t(10) 95%" 0.95 reject reject 0 -0.092302 -0.043941 "pof" accept 0.70347 1966 1000 0.95
"S&P" "t(10) 97.5%" 0.975 reject reject 0.001 -0.11714 -0.052575 "pof" accept 0.40682 1966 1000 0.95
"S&P" "t(10) 99%" 0.99 reject reject 0.003 -0.14608 -0.085433 "pof" accept 0.11536 1966 1000 0.95
Input Arguments
ebts
— esbacktestbysim
object
object
esbacktestbysim
(ebts
) object,
which contains a copy of the given data (the
PortfolioData
, VarData
,
ESData
, and Distribution
properties) and all combinations of portfolio ID, VaR ID, and VaR levels
to be tested. For more information on creating an
esbacktestbysim
object, see esbacktestbysim
.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: [TestResults,SimTestStatistic] =
conditional(ebts,'TestLevel',0.99)
TestLevel
— Test confidence level
0.95
(default) | numeric value between 0
and
1
Test confidence level, specified as the comma-separated pair
consisting of 'TestLevel'
and a numeric value
between 0
and 1
.
Data Types: double
VaRTest
— Indicator for VaR back test
'pof'
(default) | character vector with a value of 'tl'
,
'bin'
, 'pof'
,
'tuff'
, 'cc'
,
'cci'
, 'tbf'
, or
'tbfi'
| string array with a value of 'tl'
,
'bin'
, 'pof'
,
'tuff'
, 'cc'
,
'cci'
, 'tbf'
, or
'tbfi'
Indicator for VaR back test, specified as the comma-separated pair
consisting of 'VaRTest'
and a character vector or
string array with a value of 'tl'
,
'bin'
, 'pof'
,
'tuff'
, 'cc'
,
'cci'
, 'tbf'
, or
'tbfi'
. For more information on these VaR
backtests, see varbacktest
.
Note
The specified VaRTest
is run using the
same TestLevel
value that is specified
with the TestLevel
name-value pair
argument in the conditional
function.
Data Types: char
| string
Output Arguments
TestResults
— Results
table
Results, returned as a table where the rows correspond to all combinations of portfolio ID, VaR ID, and VaR levels to be tested. The columns correspond to the following information:
'PortfolioID'
— Portfolio ID for the given data.'VaRID'
— VaR ID for each of the VaR data columns provided.'VaRLevel'
— VaR level for the corresponding VaR data column.'Conditional'
— Categorical array with categories 'accept' and 'reject' indicating the result of the conditional test. This result combines the outcome of the'ConditionalOnly'
column and the VaR test.'ConditionalOnly'
— Categorical array with categories 'accept' and 'reject' indicating the result of the standalone conditional test, independent of the VaR test outcome.'PValue'
— P-value of the standalone conditional test (for the'ConditionalOnly'
column).'TestStatistic'
— Conditional test statistic (for the'ConditionalOnly'
column).'CriticalValue'
— Critical value for the conditional test.'VaRTest'
— String array indicating the selected VaR test as specified by theVaRTest
argument.'VaRTestResult'
— Categorical array with categories'accept'
and'reject'
indicating the result of the VaR test selected with the'VaRTest'
argument.'VaRTestPValue'
— P-value for the VaR backtest. If the traffic-light test (tl
) is used, this is 1 minus the traffic-light test's'Probability'
column value.'Observations'
— Number of observations.'Scenarios'
— Number of scenarios simulated to get the p-values.'TestLevel'
— Test confidence level.
Note
For the test results, the terms 'accept'
and
'reject'
are used for convenience.
Technically, a test does not accept a model; rather, a test fails to
reject it.
SimTestStatistic
— Simulated values of test statistic
numeric array
Simulated values of the test statistic, returned as a
NumVaRs
-by-NumScenarios
numeric array.
More About
Conditional Test by Acerbi and Szekely
The conditional test is also known as the first Acerbi-Szekely test.
The conditional test statistic is based on the conditional relationship
where
X
t is the portfolio outcome, that is
the portfolio return or portfolio profit and loss for period
t.
VaR
t is the estimated VaR for period
t.
ES
t is the estimated expected
shortfall for period t.
The number of failures is defined as
where
N
is the number of periods in the test window
(t = 1
,...,N
).
I
t is the VaR failure indicator on
period t with a value of 1
if
X
t < -VaR, and
0
otherwise.
The conditional test statistic is defined as:
The conditional test has two parts. A VaR backtest, specified by the
VaRTest
name-value pair argument, must be run for the
number of failures (NumFailures
), and a standalone
conditional test is performed for the conditional test statistic
Z
cond. The conditional test
accepts the model only when both the VaR test and the standalone conditional
test accept the model.
Significance of the Test
Under the assumption that the distributional assumptions are
correct, the expected value of the test statistic
Z
cond, assuming at least one VaR
failure, is 0
.
This is expressed as:
Negative values of the test statistic indicate risk underestimation. The
conditional test is a one-sided test that rejects when there is evidence that
the model underestimates risk (for technical details on the null and alternative
hypotheses, see Acerbi-Szekely, 2014). The conditional test rejects the model
when the p-value is less than 1
minus the
test confidence level.
For more information on the steps to simulate the test statistics and the
details for the computation of the p-values and critical
values, see simulate
.
Edge Cases
The conditional test statistic is undefined
(NaN
) when there are no VaR failures in the data
(NumFailures
= 0
).
The p-value is set to NaN
in these
cases, and test result is to 'accept'
, because there is no
evidence of risk underestimation.
Likewise, the simulated conditional test statistic is undefined
(NaN
) for scenarios with no VaR failures. These scenarios
are discarded for the estimation of the significance of the test. Under the
assumption that the distributional assumptions are correct, , so the significance is computed over scenarios with at least
one failure (NumFailures
> 0
). The number
of scenarios reported by the conditional
test function is the
number of scenarios with at least one VaR failure. The number of scenarios
reported can be smaller than the total number of scenarios simulated. The
critical value is estimated over the scenarios with at least one VaR failure. If
the simulated test statistic is NaN
for all scenarios, the
critical value is set to NaN
. Scenarios with no failures are
more likely as the expected number of failures
Np
VaR gets smaller.
References
[1] Acerbi, C. and Szekely, B. Backtesting Expected Shortfall. MSCI Inc. December, 2014.
Version History
Introduced in R2017b
See Also
summary
| runtests
| unconditional
| quantile
| simulate
| minBiasRelative
| minBiasAbsolute
| esbacktestbysim
| tl
| bin
| pof
| tuff
| cc
| cci
| tbf
| tbfi
| esbacktestbyde
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other bat365 country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)