runtests
Run all expected shortfall (ES) backtests for esbacktest
object
Description
runs all the tests for the TestResults
= runtests(ebt
)esbacktest
object.
runtests
reports only the final test result. For test
details, such as p-values, run the individual tests:
adds an optional name-value pair argument for TestResults
= runtests(ebt
,Name,Value
)TestLevel
.
Examples
Run All ES Backtests
Create an esbacktest
object.
load ESBacktestData ebt = esbacktest(Returns,VaRModel1,ESModel1,'VaRLevel',VaRLevel)
ebt = esbacktest with properties: PortfolioData: [1966x1 double] VaRData: [1966x1 double] ESData: [1966x1 double] Time: [1966x1 double] PortfolioID: "Portfolio" VaRID: "VaR" VaRLevel: 0.9750
Generate the TestResults
report for all ES backtests.
TestResults = runtests(ebt,'TestLevel',0.99)
TestResults=1×5 table
PortfolioID VaRID VaRLevel UnconditionalNormal UnconditionalT
___________ _____ ________ ___________________ ______________
"Portfolio" "VaR" 0.975 reject accept
Generate the TestResults
report for all ES backtests using the name-value argument for 'ShowDetails'
to display the test confidence level.
TestResults = runtests(ebt,'TestLevel',0.99,'ShowDetails',true)
TestResults=1×6 table
PortfolioID VaRID VaRLevel UnconditionalNormal UnconditionalT TestLevel
___________ _____ ________ ___________________ ______________ _________
"Portfolio" "VaR" 0.975 reject accept 0.99
Input Arguments
ebt
— esbacktest
object
object
esbacktest
(ebt
) object, which
contains a copy of the given data (the PortfolioData
,
VarData
, and ESData
properties) and all combinations of portfolio ID, VaR ID, and VaR levels
to be tested. For more information on creating an
esbacktest
object, see esbacktest
.
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 =
runtests(ebt,'TestLevel',0.99)
TestLevel
— Test confidence level
0.95
(default) | numeric value between 0.5
and 0.9999
Test confidence level, specified as the comma-separated pair
consisting of 'TestLevel'
and a numeric value
between 0.5
and 0.9999
.
Data Types: double
ShowDetails
— Indicates if the output displays a column showing the test confidence level
false
(default) | scalar logical with a value of true
or
false
Indicates if the output displays a column showing the test
confidence level, specified as the comma-separated pair consisting
of 'ShowDetails'
and a scalar logical
value.
Data Types: logical
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'UnconditionalNormal'
— Categorical array with categories 'accept' and 'reject' that indicate the result of the unconditional normal test'UnconditionalT'
— Categorical array with categories 'accept' and 'reject' that indicate the result of the unconditional t test
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.
Version History
Introduced in R2017b
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 MathWorks 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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)