Simulate expected shortfall (ES) test statistics
performs a simulation of ES test statistics. The ebts
= simulate(ebts
)simulate
function simulates portfolio outcomes according to the distribution assumptions
indicated in the esbacktestbysim
object, and
calculates all the supported test statistics under each scenario. The simulated
test statistics are used to estimate the significance of the ES backtests.
adds optional name-value pair arguments.ebts
= simulate(ebts
,Name,Value
)
Create an esbacktestbysim
object and run a simulation of 1000 scenarios.
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);
The unconditional test reports 1000 scenarios (see the Scenarios
column in the report).
unconditional(ebts)
ans=3×10 table
PortfolioID VaRID VaRLevel Unconditional PValue TestStatistic CriticalValue Observations Scenarios TestLevel
___________ _____________ ________ _____________ ______ _____________ _____________ ____________ _________ _________
"S&P" "t(10) 95%" 0.95 accept 0.093 -0.13342 -0.16252 1966 1000 0.95
"S&P" "t(10) 97.5%" 0.975 reject 0.031 -0.25011 -0.2268 1966 1000 0.95
"S&P" "t(10) 99%" 0.99 reject 0.008 -0.57396 -0.38264 1966 1000 0.95
Run a second simulation with 5000 scenarios using the simulate
function. Rerun the unconditional test using the updated esbacktestbysim
object. Notice that the test now shows 5,000 scenarios along with updated p-values and critical values.
ebts = simulate(ebts,'NumScenarios',5000);
unconditional(ebts)
ans=3×10 table
PortfolioID VaRID VaRLevel Unconditional PValue TestStatistic CriticalValue Observations Scenarios TestLevel
___________ _____________ ________ _____________ ______ _____________ _____________ ____________ _________ _________
"S&P" "t(10) 95%" 0.95 accept 0.0984 -0.13342 -0.17216 1966 5000 0.95
"S&P" "t(10) 97.5%" 0.975 reject 0.0456 -0.25011 -0.24251 1966 5000 0.95
"S&P" "t(10) 99%" 0.99 reject 0.0104 -0.57396 -0.40089 1966 5000 0.95
ebts
— esbacktestbysim
objectesbacktestbysim
(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
.
Specify optional
comma-separated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding value.
Name
must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
ebts =
simulate(ebts,'NumScenarios',1000000,'BlockSize',10000,'TestList','conditional')
'NumScenarios'
— Number of scenarios to simulate1000
(default) | positive integerNumber of scenarios to simulate, specified using the
comma-separated pair consisting of 'NumScenarios'
and a positive integer.
Data Types: double
'BlockSize'
— Number of scenarios to simulate in single simulation block1000
(default) | positive integerNumber of scenarios to simulate in a single simulation block,
specified using the comma-separated pair consisting of
'BlockSize'
and a positive integer.
Data Types: double
'TestList'
— Indicator for which test statistics to simulate["conditional","unconditional","quantile"]
(default) | character vector or string the value
conditional
,
unconditional
, or
quantile
Indicator for which test statistics to simulate, specified as the
comma-separated pair consisting of 'TestList'
and
a cell array of character vectors or a string array with the value
conditional
,
unconditional
, or quantile
.
Data Types: cell
| string
ebts
— Updated esbacktestbysim
objectesbacktestbysim
(ebts
), returned
as an updated object. After running simulate
, the
updated esbacktestbysim
object stores the simulated
test statistics, which are used to calculate p-values
and generate test results.
For more information on an esbacktestbysim
object,
see esbacktestbysim
.
The VaR and ES models assume that for each period
t, the portfolio outcomes
X
t have a cumulative probability
distribution P
t.
Under the assumption that the distributions
P
t are correct (the null
hypothesis), test statistics are simulated by:
Simulating M
scenarios of N
observations each, for example, , with , t
=
1
,…,N
, and
s
=
1
,…,M
.
For each simulated scenario
X
s, compute the
test statistic of interest
Z
s =
Z
(X
s),
s
=
1
,…,M
.
The resulting M
simulated test statistic values
Z
1,…,Z
M
from a distribution of the test statistic assuming the probability
distributions P
t are
correct.
The p-value is defined as the proportion of scenarios for which the simulated test statistic is smaller than the test statistic evaluated at the observed portfolio outcomes: :
where I
(Z
s ≤
Z
obs) is an indicator function
with a value of 1
if
Z
s ≤
Z
obs, and 0
otherwise. If P
test is
1
minus the test confidence level, the test result is to
‘reject’
if .
The critical value is defined as the minimum simulated test statistic
Z
critwith a
p-value greater than or equal to
P
test.
[1] Acerbi, C., and B. Szekely. Backtesting Expected Shortfall. MSCI Inc. December, 2014.
conditional
| esbacktestbyde
| esbacktestbysim
| quantile
| runtests
| summary
| unconditional
You have a modified version of this example. Do you want to open this example with your edits?