Main Content

select

Select value-at-risk (VaR) data from varbacktest object

Since R2023b

    Description

    example

    subvbt = select(vbt,Name=Value) returns a selection of VaR backtesting data. For example, subvbt = select(vbt,TimeRange=timeRange) selects the portfolio and VaR data for a specified time range.

    Examples

    collapse all

    Use the select function and specify the optional arguments TimeRange and NewPortfolioID to create a varbacktest subobject containing data for Q1 of year 2000. Reset the portfolio ID to reflect your selection.

    load VaRBacktestData
    vbt = varbacktest(EquityIndex,Normal95,'Time',Date);
    timeRange = [datetime(2000,1,1),datetime(2000,3,31)];
    subvbt = select(vbt,TimeRange=timeRange,NewPortfolioID="Equity, Q1 2000")
    subvbt = 
      varbacktest with properties:
    
        PortfolioData: [65x1 double]
              VaRData: [65x1 double]
                 Time: [65x1 datetime]
          PortfolioID: "Equity, Q1 2000"
                VaRID: "VaR"
             VaRLevel: 0.9500
    
    

    Input Arguments

    collapse all

    VaR backtest object, specified as a varbacktest object. vbt 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.

    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.

    Example: subvbt = select(vbt,TimeRange=[1,100])

    Time range for the VaR backtesting data you would like to select, specified as either of the following:

    • Numeric row vector, datetime row vector, or duration row vector with the data type matching the data type of the Time property vector of in varbacktest object.

    • Logical row vector with the size matching the size of the Time property vector in the varbacktest object.

    The output for the varbacktest object contains data points corresponding to the time window TimeRange(1) through TimeRange(2) or to the time points specified by a logical row vector. If you do not specify TimeRange, the select function includes all time points in the output window.

    Example: subvbt = select(vbt,TimeRange=[1,100])

    Example: subvbt = select(vbt,TimeRange=[datetime(2000,1,1),datetime(2000,3,31)])

    Data Types: double | datetime | duration | logical

    VaR IDs from the input varbacktest object, specified as a string vector. The output for the varbacktest object contains the selected VaR data.

    Example: subvbt = select(vbt,VaRID=["Historical95","Historical99"])

    Data Types: string

    New portfolio ID in the output for the varbacktest object, specified as a string scalar.

    Example: subvbt = select(vbt,TimeRange=timeRange,NewPortfolioID="Equity Q1 2000")

    Data Types: string

    Version History

    Introduced in R2023b