Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

runtests

Run all expected shortfall backtests (ES) for esbacktestbysim object

Syntax

TestResults = runtests(ebts)
TestResults = runtests(ebts,Name,Value)

Description

example

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.

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×6 table

    PortfolioID        VaRID        VaRLevel    Conditional    Unconditional    Quantile
    ___________    _____________    ________    ___________    _____________    ________

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

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 Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: TestResults = runtests(ebts,'TestLevel',0.99)

collapse all

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

Data Types: double

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

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.

Introduced in R2017b

Was this topic helpful?