# portalloc

Optimal capital allocation to efficient frontier portfolios

## Syntax

``[RiskyRisk,RiskyReturn,RiskyWts,RiskyFraction,OverallRisk,OverallReturn] = portalloc(PortRisk,PortReturn,PortWts,RisklessRate)``
``[RiskyRisk,RiskyReturn,RiskyWts,RiskyFraction,OverallRisk,OverallReturn] = portalloc(___,BorrowRate,RiskAversion)``
``portalloc(PortRisk,PortReturn,PortWts,RisklessRate,BorrowRate,RiskAversion)``

## Description

example

````[RiskyRisk,RiskyReturn,RiskyWts,RiskyFraction,OverallRisk,OverallReturn] = portalloc(PortRisk,PortReturn,PortWts,RisklessRate)` calculates the optimal risky portfolio and the optimal allocation of funds between that risky portfolio of `NASSETS` and the risk-free asset.```

example

````[RiskyRisk,RiskyReturn,RiskyWts,RiskyFraction,OverallRisk,OverallReturn] = portalloc(___,BorrowRate,RiskAversion)` specifies options using one or more optional arguments in addition to the input arguments in the previous syntax. ```

example

````portalloc(PortRisk,PortReturn,PortWts,RisklessRate,BorrowRate,RiskAversion)` when invoked without any output arguments, a graph of the optimal capital allocation decision is displayed.```

## Examples

collapse all

This example shows how to compute the optimal risky portfolio by generating the efficient frontier from the asset data and then finding the optimal risky portfolio and allocate capital. The risk-free investment return is 8%, and the borrowing rate is 12%.

```ExpReturn = [0.1 0.2 0.15]; ExpCovariance = [0.005 -0.010 0.004 -0.010 0.040 -0.002 0.004 -0.002 0.023]; [PortRisk, PortReturn, PortWts] = portopt(ExpReturn,... ExpCovariance); RisklessRate = 0.08; BorrowRate = 0.12; RiskAversion = 3; [RiskyRisk, RiskyReturn, RiskyWts, RiskyFraction, ... OverallRisk, OverallReturn] = portalloc(PortRisk, PortReturn,... PortWts, RisklessRate, BorrowRate, RiskAversion)```
```RiskyRisk = 0.1283 ```
```RiskyReturn = 0.1788 ```
```RiskyWts = 1×3 0.0265 0.6023 0.3712 ```
```RiskyFraction = 1.1898 ```
```OverallRisk = 0.1527 ```
```OverallReturn = 0.1899 ```

## Input Arguments

collapse all

Standard deviation of each risky asset efficient frontier portfolio, specified as an `NPORTS`-by-`1` vector.

Data Types: `double`

Expected return of each risky asset efficient frontier portfolio, specified an `NPORTS`-by-`1` vector.

Data Types: `double`

Weights allocated to each asset, specified as an `NPORTS` by number of assets (`NASSETS`) matrix of weights allocated to each asset. Each row represents an efficient frontier portfolio of risky assets. Total of all weights in a portfolio is `1`.

Data Types: `double`

Risk-free lending rate, specified as a scalar decimal.

Data Types: `double`

(Optional) Borrowing rate, specified as a scalar decimal. If borrowing is not desired, or not an option, set the `BorrowRate` to `NaN` (which is the default value).

Data Types: `double`

(Optional) Coefficient of investor's degree of risk aversion, specified as a scalar numeric. Higher numbers indicate greater risk aversion. Typical coefficients range from `2.0` through `4.0`. The default value of `RiskAversion` is `3`.

### Note

Consider that a less risk-averse investor would be expected to accept much greater risk and, consequently, a more risk-averse investor would accept less risk for a given level of return. Therefore, making the `RiskAversion` argument higher reflects the risk-return tradeoff in the data.

Data Types: `double`

## Output Arguments

collapse all

Standard deviation of the optimal risky portfolio, returned as a scalar.

Expected return of the optimal risky portfolio, returned as a scalar.

Weights allocated to the optimal risky portfolio, returned a `1`-by-`NASSETS` vector. The total of all weights in the portfolio is `1`.

Fraction of the complete portfolio (that is, the overall portfolio including risky and risk-free assets) allocated to the risky portfolio, returned as a scalar.

Standard deviation of the optimal overall portfolio, returned as a scalar.

Expected rate of return of the optimal overall portfolio, returned as a scalar.

 Bodie, Z., Kane, A., and A. Marcus. Investments. McGraw-Hill Education, 2013.