# Documentation

### This is machine translation

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

# estimatePortRisk

Estimate portfolio risk according to risk proxy associated with corresponding object

Use the `estimatePortRisk ` function with a `Portfolio`, `PortfolioCVaR`, or `PortfolioMAD` object to estimate portfolio risk according to the risk proxy associated with the corresponding object.

For details on the respective workflows when using these different objects, see Portfolio Object Workflow, PortfolioCVaR Object Workflow, and PortfolioMAD Object Workflow.

## Syntax

``prsk = estimatePortRisk(obj,pwgt)``

## Description

example

````prsk = estimatePortRisk(obj,pwgt)` estimates portfolio risk according to the risk proxy associated with the corresponding object (`obj`).```

## Examples

collapse all

Given portfolio `p`, use the `estimatePortRisk` function to show the standard deviation of portfolio returns for each portfolio in `pwgt`.

```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 ]; p = Portfolio; p = setAssetMoments(p, m, C); p = setDefaultConstraints(p); pwgt = estimateFrontierLimits(p); prsk = estimatePortRisk(p, pwgt); disp(prsk)```
``` 0.0769 0.3500 ```

Given a portfolio `pwgt`, use the `estimatePortRisk` function to show the conditional value-at-risk (CVaR) of portfolio returns for each 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; rng(11); AssetScenarios = mvnrnd(m, C, 20000); p = PortfolioCVaR; p = setScenarios(p, AssetScenarios); p = setDefaultConstraints(p); p = setProbabilityLevel(p, 0.95); pwgt = estimateFrontierLimits(p); prsk = estimatePortRisk(p, pwgt); disp(prsk)```
``` 0.0407 0.1911 ```

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

Given a portfolio `pwgt`, use the `estimatePortRisk` function to show the mean-absolute deviation of portfolio returns for each 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; rng(11); AssetScenarios = mvnrnd(m, C, 20000); p = PortfolioMAD; p = setScenarios(p, AssetScenarios); p = setDefaultConstraints(p); pwgt = estimateFrontierLimits(p); prsk = estimatePortRisk(p, pwgt); disp(prsk)```
``` 0.0177 0.0809 ```

The function `rng`() 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 `Portfolio`, `PortfolioCVaR`, or `PortfolioMAD` object. For more information on creating a portfolio object, see

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 portfolio risk according to the risk proxy associated with the corresponding object (`obj`) for each portfolio in `pwgt`, returned as a `NumPorts` vector.

`prsk` is returned for a `Portfolio`, `PortfolioCVaR`, or `PortfolioMAD` input object (`obj`).

## Tips

You can also use dot notation to estimate portfolio risk according to the risk proxy associated with the corresponding object (`obj`).

`prsk = obj.estimatePortRisk(pwgt);`

﻿