This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

estimateScenarioMoments

Estimate mean and covariance of asset return scenarios

Syntax

[ScenarioMean,ScenarioCovar] = estimateScenarioMoments(obj)

Description

example

[ScenarioMean,ScenarioCovar] = estimateScenarioMoments(obj) estimates mean and covariance of asset return scenarios for PortfolioCVaR or PortfolioMAD objects. For details on the workflows, see PortfolioCVaR Object Workflow, and PortfolioMAD Object Workflow.

Examples

collapse all

Given PortfolioCVaR object p, use the estimatePortRisk function to estimate mean and covariance of asset return scenarios.

m = [ 0.05; 0.1; 0.12; 0.18 ];
C = [ 0.0064 0.00408 0.00192 0; 
    0.00408 0.0289 0.0204 0.0119;
    0.00192 0.0204 0.0576 0.0336;
    0 0.0119 0.0336 0.1225 ];
m = m/12;
C = C/12;

rng(11);

AssetScenarios = mvnrnd(m, C, 20000);

p = PortfolioCVaR;
p = setScenarios(p, AssetScenarios);
p = setDefaultConstraints(p);
p = setProbabilityLevel(p, 0.95);

[ScenarioMean, ScenarioCovar] = estimateScenarioMoments(p)
ScenarioMean = 4×1

    0.0039
    0.0082
    0.0102
    0.0154

ScenarioCovar = 4×4

    0.0005    0.0003    0.0001   -0.0001
    0.0003    0.0024    0.0017    0.0010
    0.0001    0.0017    0.0048    0.0028
   -0.0001    0.0010    0.0028    0.0102

The function rng(seed) resets the random number generator to produce the documented results. It is not necessary to reset the random number generator to simulate scenarios.

Given PortfolioMAD object p, use the estimatePortRisk function to estimate mean and covariance of asset return scenarios.

m = [ 0.05; 0.1; 0.12; 0.18 ];
C = [ 0.0064 0.00408 0.00192 0; 
    0.00408 0.0289 0.0204 0.0119;
    0.00192 0.0204 0.0576 0.0336;
    0 0.0119 0.0336 0.1225 ];
m = m/12;
C = C/12;

rng(11);

AssetScenarios = mvnrnd(m, C, 20000);

p = PortfolioMAD;
p = setScenarios(p, AssetScenarios);
p = setDefaultConstraints(p);

[ScenarioMean, ScenarioCovar] = estimateScenarioMoments(p)
ScenarioMean = 4×1

    0.0039
    0.0082
    0.0102
    0.0154

ScenarioCovar = 4×4

    0.0005    0.0003    0.0001   -0.0001
    0.0003    0.0024    0.0017    0.0010
    0.0001    0.0017    0.0048    0.0028
   -0.0001    0.0010    0.0028    0.0102

The function rng(seed) resets the random number generator to produce the documented results. It is not necessary to reset the random number generator to simulate scenarios.

Input Arguments

collapse all

Object for portfolio, specified using a PortfolioCVaR or PortfolioMAD object.

For more information on creating a PortfolioCVaR or PortfolioMAD object, see

Data Types: object

Output Arguments

collapse all

Estimate for mean of scenarios, returned as a NumPorts vector or [].

Note

If no scenarios are associated with the specified object, both ScenarioMean and ScenarioCovar are set to empty [].

Estimate for covariance of scenarios, returned as a NumAssets-by-NumAssets matrix or [].

Note

If no scenarios are associated with the specified object, both ScenarioMean and ScenarioCovar are set to empty [].

Tips

You can also use dot notation to estimate the mean and covariance of asset return scenarios for a portfolio.

[ScenarioMean, ScenarioCovar] = obj.estimateScenarioMoments

Introduced in R2012b