Main Content

runtests

Run all expected shortfall backtests (ES) for esbacktestbysim object

Description

TestResults = runtests(ebts) runs all the tests for the esbacktestbysim object. runtests reports only the final test result. For test details, such as p-values, run the individual tests:

example

TestResults = runtests(ebts,Name,Value) adds an optional name-value pair argument for TestLevel.

example

Examples

collapse all

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 TestResults report for all ES backtests.

TestResults = runtests(ebts,'TestLevel',0.99)
TestResults=3×8 table
    PortfolioID        VaRID        VaRLevel    Conditional    Unconditional    Quantile    MinBiasAbsolute    MinBiasRelative
    ___________    _____________    ________    ___________    _____________    ________    _______________    _______________

       "S&P"       "t(10) 95%"        0.95        reject          accept         reject         accept             reject     
       "S&P"       "t(10) 97.5%"     0.975        reject          accept         reject         accept             reject     
       "S&P"       "t(10) 99%"        0.99        reject          reject         reject         reject             reject     

Generate the TestResults report for all ES backtests using the name-value argument for 'ShowDetails' to display the test confidence level.

TestResults = runtests(ebts,'TestLevel',0.99,'ShowDetails',true)
TestResults=3×9 table
    PortfolioID        VaRID        VaRLevel    Conditional    Unconditional    Quantile    MinBiasAbsolute    MinBiasRelative    TestLevel
    ___________    _____________    ________    ___________    _____________    ________    _______________    _______________    _________

       "S&P"       "t(10) 95%"        0.95        reject          accept         reject         accept             reject           0.99   
       "S&P"       "t(10) 97.5%"     0.975        reject          accept         reject         accept             reject           0.99   
       "S&P"       "t(10) 99%"        0.99        reject          reject         reject         reject             reject           0.99   

Input Arguments

collapse all

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 = runtests(ebts,'TestLevel',0.99)

Test confidence level, specified as the comma-separated pair consisting of 'TestLevel' and a numeric value between 0 and 1.

Data Types: double

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

collapse all

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

  • 'Unconditional' — Categorical array with categories 'accept' and 'reject' indicating the result of the unconditional test

  • 'Quantile' — Categorical array with categories 'accept' and 'reject' indicating the result of the quantile test

  • 'minBiasAbsolute' — Categorical array with categories 'accept' and 'reject' indicating the result of the minBiasAbsolute test

  • 'minBiasRelative' — Categorical array with categories 'accept' and 'reject' indicating the result of the minBiasRelative test

Note

If you request to show additional details by setting the ShowDetails optional input to true, then the output also contains a TestLevel column for the confidence level.

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