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 tests in varbacktest

Syntax

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

Description

example

TestResults = runtests(vbt) runs all the tests in the varbacktest object. runtests reports only the final test result. For test details such as likelihood ratios, run individual tests:

  • tl — Traffic light test

  • bin — Binomial test

  • pof — Proportion of failures

  • tuff — Time until first failure

  • cc — Conditional coverage mixed

  • cci — Conditional coverage independence

  • tbf — Time between failures mixed

  • tbfi — Time between failures independence

example

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

Examples

collapse all

Create a varbacktest object.

load VaRBacktestData
vbt = varbacktest(EquityIndex,Normal95)
vbt = 

  varbacktest with properties:

    PortfolioData: [1043x1 double]
          VaRData: [1043x1 double]
      PortfolioID: "Portfolio"
            VaRID: "VaR"
         VaRLevel: 0.9500

Generate the TestResults report for all VaR backtests.

TestResults = runtests(vbt,'TestLevel',0.99)
TestResults =

  1x11 table

    PortfolioID    VaRID    VaRLevel     TL       Bin       POF       TUFF       CC       CCI       TBF       TBFI 
    ___________    _____    ________    _____    ______    ______    ______    ______    ______    ______    ______

    "Portfolio"    "VaR"    0.95        green    accept    accept    accept    accept    accept    reject    reject

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 =

  6x11 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

collapse all

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 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(vbt,'TestLevel',0.99)

collapse all

Test confidence level, specified as the comma-separated pair consisting of 'TestLevel' and a numeric 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

  • 'TL' — Categorical (ordinal) array with categories green, yellow, and red that indicate the result of the traffic light (tl) test

  • 'Bin' — Categorical array with categories accept and reject that indicate the result of the bin test

  • 'POF' — Categorical array with the categories accept and reject that indicate the result of the pof test.

  • 'TUFF' — Categorical array with the categories accept and reject that indicate the result of the tuff test

  • 'CC' — Categorical array with the categories accept and reject that indicate the result of the cc test

  • 'CCI' — Categorical array with the categories accept and reject that indicate the result of the cci test

  • 'TBF' — Categorical array with the categories accept and reject that indicate the result of the tbf test

  • 'TBFI' — Categorical array with the categories accept and reject that indicate the result of the tbfi 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 R2016b

Was this topic helpful?