runtests
Run all tests in varbacktest
Description
runs all the tests in the TestResults
= runtests(vbt
)varbacktest
object.
runtests
reports only the final test result. For test
details such as likelihood ratios, run individual tests:
adds an optional name-value pair argument for TestResults
= runtests(vbt
,Name,Value
)TestLevel
.
Examples
Run All VaR Backtests
Create a varbacktest
object.
load VaRBacktestData
vbt = varbacktest(EquityIndex,Normal95)
vbt = varbacktest with properties: PortfolioData: [1043x1 double] VaRData: [1043x1 double] Time: [1043x1 double] PortfolioID: "Portfolio" VaRID: "VaR" VaRLevel: 0.9500
Generate the TestResults
report for all VaR backtests.
TestResults = runtests(vbt,'TestLevel',0.99)
TestResults=1×11 table
PortfolioID VaRID VaRLevel TL Bin POF TUFF CC CCI TBF TBFI
___________ _____ ________ _____ ______ ______ ______ ______ ______ ______ ______
"Portfolio" "VaR" 0.95 green accept accept accept accept accept reject reject
Generate the TestResults
report for all VaR backtests using the name-value argument for 'ShowDetails'
to display the test confidence level.
TestResults = runtests(vbt,'TestLevel',0.99,"ShowDetails",true)
TestResults=1×12 table
PortfolioID VaRID VaRLevel TL Bin POF TUFF CC CCI TBF TBFI TestLevel
___________ _____ ________ _____ ______ ______ ______ ______ ______ ______ ______ _________
"Portfolio" "VaR" 0.95 green accept accept accept accept accept reject reject 0.99
Run All VaR Backtests for Multiple VaRs at Different Confidence Levels
Use the varbacktest
constructor with name-value pair arguments to create a varbacktest
object and run all tests.
load VaRBacktestData vbt = varbacktest(EquityIndex,... [Normal95 Normal99 Historical95 Historical99 EWMA95 EWMA99],... 'PortfolioID','Equity',... 'VaRID',{'Normal95' 'Normal99' 'Historical95' 'Historical99' 'EWMA95' 'EWMA99'},... 'VaRLevel',[0.95 0.99 0.95 0.99 0.95 0.99]); runtests(vbt)
ans=6×11 table
PortfolioID VaRID VaRLevel TL Bin POF TUFF CC CCI TBF TBFI
___________ ______________ ________ ______ ______ ______ ______ ______ ______ ______ ______
"Equity" "Normal95" 0.95 green accept accept accept accept accept reject reject
"Equity" "Normal99" 0.99 yellow reject accept accept accept accept accept accept
"Equity" "Historical95" 0.95 green accept accept accept accept accept reject reject
"Equity" "Historical99" 0.99 green accept accept accept accept accept accept accept
"Equity" "EWMA95" 0.95 green accept accept accept accept accept accept accept
"Equity" "EWMA99" 0.99 yellow reject reject accept reject accept reject accept
Input Arguments
vbt
— varbacktest
object
object
varbacktest
(vbt
) object,
contains a copy of the given data (the PortfolioData
and VarData
properties) and all combinations of
portfolio ID, VaR ID, and VaR levels to be tested. For more information
on creating a varbacktest
object, see varbacktest
.
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(vbt,'TestLevel',0.99)
TestLevel
— Test confidence level
0.95
(default) | numeric between 0
and
1
Test confidence level, specified as the comma-separated pair
consisting of 'TestLevel'
and a numeric between
0
and 1
.
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'TL'
— Categorical (ordinal) array with categoriesgreen
,yellow
, andred
that indicate the result of the traffic light (tl
) test'Bin'
— Categorical array with categoriesaccept
andreject
that indicate the result of thebin
test'POF'
— Categorical array with the categoriesaccept
andreject
that indicate the result of thepof
test.'TUFF'
— Categorical array with the categoriesaccept
andreject
that indicate the result of thetuff
test'CC'
— Categorical array with the categoriesaccept
andreject
that indicate the result of thecc
test'CCI'
— Categorical array with the categoriesaccept
andreject
that indicate the result of thecci
test'TBF'
— Categorical array with the categoriesaccept
andreject
that indicate the result of thetbf
test'TBFI'
— Categorical array with the categoriesaccept
andreject
that indicate the result of thetbfi
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 R2016b
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
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)