# estimateFrontierLimits

Estimate optimal portfolios at endpoints of efficient frontier

## Syntax

``````[pwgt,pbuy,psell] = estimateFrontierLimits(obj)``````
``````[pwgt,pbuy,psell] = estimateFrontierLimits(obj,Choice)``````

## Description

example

``````[pwgt,pbuy,psell] = estimateFrontierLimits(obj)``` estimates optimal portfolios at endpoints of efficient frontier for `Portfolio`, `PortfolioCVaR`, or `PortfolioMAD` objects. For details on the respective workflows when using these different objects, see Portfolio Object Workflow, PortfolioCVaR Object Workflow, and PortfolioMAD Object Workflow.```

example

``````[pwgt,pbuy,psell] = estimateFrontierLimits(obj,Choice)``` estimates optimal portfolios at endpoints of efficient frontier with an additional option specified for the `Choice` argument.```

## Examples

collapse all

Given portfolio `p`, the `estimateFrontierLimits` function obtains the endpoint portfolios.

```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); disp(pwgt);```
``` 0.8891 0 0.0369 0 0.0404 0 0.0336 1.0000 ```

When any one, or any combination of the constraints from '`Conditional'` `BoundType`, `MinNumAssets`, and `MaxNumAssets` are active, the portfolio problem is formulated as mixed integer programming problem and the MINLP solver is used.

Create a `Portfolio` object for three assets.

```AssetMean = [ 0.0101110; 0.0043532; 0.0137058 ]; AssetCovar = [ 0.00324625 0.00022983 0.00420395; 0.00022983 0.00049937 0.00019247; 0.00420395 0.00019247 0.00764097 ]; p = Portfolio('AssetMean', AssetMean, 'AssetCovar', AssetCovar); p = setDefaultConstraints(p); ```

Use `setBounds` with semicontinuous constraints to set xi = `0` or `0.02` <= `xi` <= `0.5` for all i = `1`,...`NumAssets`.

`p = setBounds(p, 0.02, 0.7,'BoundType', 'Conditional', 'NumAssets', 3); `

When working with a `Portfolio` object, the `setMinMaxNumAssets` function enables you to set up the limits on the number of assets invested (as known as cardinality) constraints. This sets the total number of allocated assets satisfying the Bound constraints that are between `MinNumAssets` and `MaxNumAssets`. By setting `MinNumAssets` = `MaxNumAssets` = 2, only two of the three assets are invested in the portfolio.

`p = setMinMaxNumAssets(p, 2, 2); `

Use `estimateFrontierLimits` to estimate the optimal portfolios at endpoints of the efficient frontier.

`[pwgt, pbuy, psell] = estimateFrontierLimits(p,'Both')`
```pwgt = 3×2 0.3000 0.3000 0.7000 0 0 0.7000 ```
```pbuy = 3×2 0.3000 0.3000 0.7000 0 0 0.7000 ```
```psell = 3×2 0 0 0 0 0 0 ```

The `estimateFrontierLimits` function uses the MINLP solver to solve this problem. Use the `setSolverMINLP` function to configure the `SolverType` and options.

`p.solverTypeMINLP`
```ans = 'OuterApproximation' ```
`p.solverOptionsMINLP`
```ans = struct with fields: MaxIterations: 1000 AbsoluteGapTolerance: 1.0000e-07 RelativeGapTolerance: 1.0000e-05 NonlinearScalingFactor: 1000 ObjectiveScalingFactor: 1000 Display: 'off' CutGeneration: 'basic' MaxIterationsInactiveCut: 30 ActiveCutTolerance: 1.0000e-07 IntMainSolverOptions: [1x1 optim.options.Intlinprog] NumIterationsEarlyIntegerConvergence: 30 ```

Given portfolio `p`, the `estimateFrontierLimits` function obtains the endpoint portfolios.

```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); disp(pwgt);```
``` 0.8454 0 0.0606 0 0.0456 0 0.0484 1.0000 ```

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 portfolio `p`, the `estimateFrontierLimits` function obtains the endpoint portfolios.

```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); disp(pwgt);```
``` 0.8823 0 0.0420 0 0.0394 0 0.0363 1.0000 ```

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

Data Types: `object`

(Optional) Indicator which portfolios to obtain at the extreme ends of the efficient frontier, specified as a character vector with values `'Both'` or `"Both"`, `'Min'` or `"Min"`, or `'Max'` or `"Max"`. The options for a `Choice` action are:

• `[]` — Compute both minimum-risk and maximum-return portfolios.

• `'Both'` or `"Both"` — Compute both minimum-risk and maximum-return portfolios.

• `'Min'` or `"Min"` — Compute minimum-risk portfolio only.

• `'Max'` or `"Max"` — Compute maximum-return portfolio only.

Data Types: `char` | `string`

## Output Arguments

collapse all

Optimal portfolios at the endpoints of the efficient frontier `TargetReturn`, 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 at the endpoints of 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 the optimal portfolios at the endpoints of the efficient frontier.

`[pwgt, pbuy, psell] = obj.estimateFrontierLimits(Choice);`

## Version History

Introduced in R2011a