select
Select value-at-risk (VaR) or expected shortfall (ES) data from backtest objects
Since R2023b
Description
subbtobj = select(
returns a selection of backtesting data, where btobj
,Name=Value
)btobj
is either an esbacktest
(since R2024a) or a varbacktest
object. For example, subbtobj =
select(btobj,TimeRange=timeRange)
selects ES or VaR data for a specified time
range.
Examples
Select VaR Backtesting Data
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 btobj = varbacktest(EquityIndex,Normal95,'Time',Date); timeRange = [datetime(2000,1,1),datetime(2000,3,31)]; subbtobj = select(btobj,TimeRange=timeRange,NewPortfolioID="Equity, Q1 2000")
subbtobj = varbacktest with properties: PortfolioData: [65x1 double] VaRData: [65x1 double] Time: [65x1 datetime] PortfolioID: "Equity, Q1 2000" VaRID: "VaR" VaRLevel: 0.9500
Select ES Backtesting Data
Use the select
function and specify the optional arguments TimeRange
and NewPortfolioID
to create an esbacktest
subobject containing data for Q1 of year 2000. Reset the portfolio ID to reflect your selection.
load ESBacktestData btobj = esbacktest(Returns,VaRModel1,ESModel1,'Time',Dates); timeRange = [datetime(2000,1,1), datetime(2000,3,31)]; subbtobj = select(btobj,TimeRange=timeRange,NewPortfolioID='S&P, Q1 2000')
subbtobj = esbacktest with properties: PortfolioData: [65x1 double] VaRData: [65x1 double] ESData: [65x1 double] Time: [65x1 datetime] PortfolioID: "S&P, Q1 2000" VaRID: "VaR" VaRLevel: 0.9500
Input Arguments
btobj
— Backtest object
varbacktest
object | esbacktest object
Backtest object, specified as either a varbacktest
or an esbacktest
object.
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: subbtobj = select(btobj,TimeRange=[1,100])
TimeRange
— Time range
row vector | datetime row vector | duration row vector | logical row vector
Time range for the backtesting data you would like to select from a
varbacktest
or esbacktest
object, 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 in the backtest objectLogical row vector with the size matching the size of the
Time
property vector in the backtest object
The output for the object contains data points corresponding to either 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: subbtobj =
select(btobj,TimeRange=[1,100])
Example: subbtobj =
select(btobj,TimeRange=[datetime(2000,1,1),datetime(2000,3,31)])
Data Types: double
| datetime
| duration
| logical
VaRID
— VaR IDs
string vector
VaR IDs from the input varbacktest
or
esbacktest
object, specified as a string vector. The output
backtest object contains the selected VaR data. If you do not specify
VaRID
, the select
function returns data for
all VaR IDs.
Example: subbtobj =
select(btobj,VaRID=["Historical95","Historical99"])
Data Types: string
NewPortfolioID
— New portfolio ID
string scalar
New portfolio ID contained the output backtest object, specified as a string
scalar. If you do not specify NewPortfolioID
,
select
function uses the portfolio ID of the input
varbacktest
or esbacktest
object.
Example: subbtobj =
select(btobj,TimeRange=timeRange,NewPortfolioID="Equity Q1
2000")
Data Types: string
Version History
Introduced in R2023bR2024a: Select ES backtest data in ES backtest objects
Return a selection of ES backtest data from ES backtest objects.
See Also
varbacktest
| esbacktest
| bin
| pof
| tuff
| cc
| cci
| tbf
| tbfi
| summary
| runtests
| append
| exceptions
| plot
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)