Main Content


Estimate value-at-risk for PortfolioCVaR object



pvar = estimatePortVaR(obj,pwgt) estimates value-at-risk for a PortfolioCVaR object where the probability level used is from the PortfolioCVaR property ProbabilityLevel. For details on the workflow, see PortfolioCVaR Object Workflow.


collapse all

Given a portfolio pwgt, use the estimatePortVaR function to estimate the value-at-risk of portfolio.

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);

pwgt = estimateFrontierLimits(p);

pvar = estimatePortVaR(p, pwgt);

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 object.

For more information on creating a PortfolioCVaR object, see

Data Types: object

Collection of portfolios, specified as a NumAssets-by-NumPorts matrix, where NumAssets is the number of assets in the universe and NumPorts is the number of portfolios in the collection of portfolios.

Data Types: double

Output Arguments

collapse all

Estimates for value-at-risk of portfolio returns for each portfolio in pwgt, returned as a NumPorts vector.


You can also use dot notation to estimate the value-at-risk of PortfolioCVaR object.

pvar = obj.estimatePortVaR(pwgt);

Introduced in R2012b