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.

simulateNormalScenariosByMoments

Simulate multivariate normal asset return scenarios from mean and covariance of asset returns

Use the simulateNormalScenariosByMoments function with a PortfolioCVaR or PortfolioMAD objects to simulate multivariate normal asset return scenarios from mean and covariance of asset returns.

For details on the workflows, see PortfolioCVaR Object Workflow, and PortfolioMAD Object Workflow.

Syntax

obj = simulateNormalScenariosByMoments(obj,AssetMean,AssetCovar,NumScenarios)
obj = simulateNormalScenariosByMoments(obj,AssetMean,AssetCovarNumScenarios,NumAssets)

Description

example

obj = simulateNormalScenariosByMoments(obj,AssetMean,AssetCovar,NumScenarios) simulates multivariate normal asset return scenarios from mean and covariance of asset returns for PortfolioCVaR or PortfolioMAD objects.

example

obj = simulateNormalScenariosByMoments(obj,AssetMean,AssetCovarNumScenarios,NumAssets) simulates multivariate normal asset return scenarios from mean and covariance of asset returns for PortfolioCVaR or PortfolioMAD objects using the optional input NumScenarios.

Note

This function overwrites existing scenarios associated with PortfolioCVaR or PortfolioMAD objects, and also, possibly, NumScenarios.

If you want to use the function multiple times and you want to simulate identical scenarios each time the function is called, precede each function call with rng(seed) using a specified integer seed.

Examples

collapse all

Given PortfolioCVaR object p, use the simulateNormalScenariosByMoments function to simulate multivariate normal asset return scenarios from moments.

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;

AssetScenarios = mvnrnd(m, C, 20000);

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

AssetMean = [.5]
AssetMean = 0.5000
AssetCovar = [.5]
AssetCovar = 0.5000
NumScenarios = 100
NumScenarios = 100
p = simulateNormalScenariosByMoments(p, AssetMean, AssetCovar, NumScenarios)
p = 
  PortfolioCVaR with properties:

             BuyCost: []
            SellCost: []
        RiskFreeRate: []
    ProbabilityLevel: 0.9500
            Turnover: []
         BuyTurnover: []
        SellTurnover: []
        NumScenarios: 100
                Name: []
           NumAssets: 4
           AssetList: []
            InitPort: []
         AInequality: []
         bInequality: []
           AEquality: []
           bEquality: []
          LowerBound: [4x1 double]
          UpperBound: []
         LowerBudget: 1
         UpperBudget: 1
         GroupMatrix: []
          LowerGroup: []
          UpperGroup: []
              GroupA: []
              GroupB: []
          LowerRatio: []
          UpperRatio: []

Given PortfolioMAD object p, use the simulateNormalScenariosByMoments function to simulate multivariate normal asset return scenarios from moments.

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;

AssetScenarios = mvnrnd(m, C, 20000);

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

AssetMean = [.5]
AssetMean = 0.5000
AssetCovar = [.5]
AssetCovar = 0.5000
NumScenarios = 100
NumScenarios = 100
p = simulateNormalScenariosByMoments(p, AssetMean, AssetCovar, NumScenarios)
p = 
  PortfolioMAD with properties:

         BuyCost: []
        SellCost: []
    RiskFreeRate: []
        Turnover: []
     BuyTurnover: []
    SellTurnover: []
    NumScenarios: 100
            Name: []
       NumAssets: 4
       AssetList: []
        InitPort: []
     AInequality: []
     bInequality: []
       AEquality: []
       bEquality: []
      LowerBound: [4x1 double]
      UpperBound: []
     LowerBudget: 1
     UpperBudget: 1
     GroupMatrix: []
      LowerGroup: []
      UpperGroup: []
          GroupA: []
          GroupB: []
      LowerRatio: []
      UpperRatio: []

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

Mean of asset returns, specified as a vector.

Note

If AssetMean is a scalar and the number of assets is known, scalar expansion occurs. If the number of assets cannot be determined, this function assumes that NumAssets = 1.

Data Types: double

Covariance of asset returns, specified as a symmetric positive-semidefinite matrix.

Note

  • If AssetCovar is a scalar and the number of assets is known, a diagonal matrix is formed with the scalar value along the diagonals. If it is not possible to determine the number of assets, this method assumes that NumAssets = 1.

  • If AssetCovar is a vector, a diagonal matrix is formed with the vector along the diagonal.

Data Types: double

Number of scenarios to simulate, specified as a positive integer.

Data Types: double

Number of assets, specified as a scalar.

Data Types: double

Output Arguments

collapse all

Updated portfolio object, returned as a PortfolioCVaR or PortfolioMAD object. For more information on creating a portfolio object, see

Tips

You can also use dot notation to simulate multivariate normal asset return scenarios from a mean and covariance of asset returns for a PortfolioCVaR or PortfolioMAD object.

obj = obj.simulateNormalScenariosByMoments(AssetMean, AssetCovar, NumScenarios, NumAssets);

Introduced in R2012b

Was this topic helpful?