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

# estimateFrontierByRisk

Estimate optimal portfolios with targeted portfolio risks

Use the `estimateFrontierByRisk` function with a `Portfolio`, `PortfolioCVaR`, or `PortfolioMAD` object to estimate optimal portfolios with targeted portfolio risks.

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

## Syntax

``````[pwgt,pbuy,psell] = estimateFrontierByRisk(obj,TargetRisk)``````

## Description

example

``````[pwgt,pbuy,psell] = estimateFrontierByRisk(obj,TargetRisk)``` estimates optimal portfolios with targeted portfolio risks.```

## Examples

collapse all

To obtain efficient portfolios that have targeted portfolio risks, the `estimateFrontierByRisk` function accepts one or more target portfolio risks and obtains efficient portfolios with the specified risks. Assume you have a universe of four assets where you want to obtain efficient portfolios with target portfolio risks of 12%, 14%, and 16%.

```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 = estimateFrontierByRisk(p, [0.12, 0.14, 0.16]); display(pwgt);```
```pwgt = 0.3984 0.2659 0.1416 0.3064 0.3791 0.4474 0.0882 0.1010 0.1131 0.2071 0.2540 0.2979 ```

To obtain efficient portfolios that have targeted portfolio risks, the `estimateFrontierByRisk` function accepts one or more target portfolio risks and obtains efficient portfolios with the specified risks. Assume you have a universe of four assets where you want to obtain efficient portfolios with target portfolio risks of 12%, 20%, and 30%.

```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 ]; rng(11); p = PortfolioCVaR; p = simulateNormalScenariosByMoments(p, m, C, 2000); p = setDefaultConstraints(p); p = setProbabilityLevel(p, 0.95); pwgt = estimateFrontierByRisk(p, [0.12, 0.20, 0.30]); display(pwgt);```
```pwgt = 0.5363 0.1388 0.0000 0.2655 0.4990 0.3830 0.0568 0.1239 0.1461 0.1413 0.2383 0.4709 ```

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.

To obtain efficient portfolios that have targeted portfolio risks, the `estimateFrontierByRisk` function accepts one or more target portfolio risks and obtains efficient portfolios with the specified risks. Assume you have a universe of four assets where you want to obtain efficient portfolios with target portfolio risks of 12%, 20%, and 25%.

```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 ]; rng(11); p = PortfolioMAD; p = simulateNormalScenariosByMoments(p, m, C, 2000); p = setDefaultConstraints(p); pwgt = estimateFrontierByRisk(p, [0.12, 0.20, 0.25]); display(pwgt);```
```pwgt = 0.1613 0.0000 0.0000 0.4777 0.2139 0.0037 0.1118 0.1381 0.1214 0.2492 0.6480 0.8749 ```

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

Target values for portfolio risk, specified as a `NumPorts` vector.

### Note

If any `TargetRisk` values are outside the range of risks for efficient portfolios, the target risk is replaced with the minimum or maximum efficient portfolio risk, depending on whether the target risk is below or above the range of efficient portfolio risks.

Data Types: `double`

## Output Arguments

collapse all

Optimal portfolios on the efficient frontier with specified target returns from `TargetRisk`, returned as a `NumAssets`-by-`NumPorts` matrix. `pwgt` is returned for a `Portfolio`, `PortfolioCVaR`, or `PortfolioMAD` input object (`obj`).

Purchases relative to an initial portfolio for optimal portfolios on the efficient frontier, returned as `NumAssets`-by-`NumPorts` matrix.

### Note

If no initial portfolio is specified in `obj.InitPort`, that value is assumed to be `0` such that ```pbuy = max(0, pwgt)``` and `psell = max(0, -pwgt)`.

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

Sales relative to an initial portfolio for optimal portfolios on the efficient frontier, returned as a `NumAssets`-by-`NumPorts` matrix.

### Note

If no initial portfolio is specified in `obj.InitPort`, that value is assumed to be `0` such that ```pbuy = max(0, pwgt)``` and `psell = max(0, -pwgt)`.

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

## Tips

You can also use dot notation to estimate optimal portfolios with targeted portfolio risks.

`[pwgt, pbuy, psell] = obj.estimateFrontierByRisk(TargetRisk);`