The efficient frontier computation functions require information
about each asset in the portfolio. This data is entered into the function
via two matrices: an expected return vector and a covariance matrix.
The expected return vector contains the average expected return for
each asset in the portfolio. The covariance matrix is a square matrix representing the interrelationships
between pairs of assets. This information can be directly specified
or can be estimated from an asset return time series with the function ewstats
.
Note:
An alternative to using these portfolio optimization functions
is to use the Portfolio object ( |
This example computes the efficient frontier of portfolios consisting of three different assets using
the function frontcon
. To visualize
the efficient frontier curve clearly, consider 10 different evenly
spaced portfolios.
Assume that the expected return of the first asset is 10%, the
second is 20%, and the third is 15%. The covariance is defined in
the matrix ExpCovariance
.
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]; NumPorts = 10;
Since there are no constraints, you can call frontcon
directly with the data you already
have. If you call frontcon
without specifying any output arguments, you get a graph
representing the efficient frontier curve.
frontcon (ExpReturn, ExpCovariance, NumPorts);
Warning: In a future release, frontcon will be removed. Use the Portfolio object instead. See the release notes for details, including examples to make the conversion. > In frontcon at 89 Warning: In a future release, portopt will no longer accept ConSet or varargin arguments. 'It will only solve the portfolio problem for long-only fully-invested portfolios. To solve more general problems, use the Portfolio object. See the release notes for details, including examples to make the conversion. > In portopt at 83 In frontcon at 228
Calling frontcon
while
specifying the output arguments returns the corresponding vectors
and arrays representing the risk, return, and weights for each of
the 10 points computed along the efficient frontier.
[PortRisk, PortReturn, PortWts] = frontcon(ExpReturn,...
ExpCovariance, NumPorts)
Warning: In a future release, frontcon will be removed. Use the Portfolio object instead. See the release notes for details, including examples to make the conversion. > In frontcon at 89 Warning: In a future release, portopt will no longer accept ConSet or varargin arguments. 'It will only solve the portfolio problem for long-only fully-invested portfolios. To solve more general problems, use the Portfolio object. See the release notes for details, including examples to make the conversion. > In portopt at 83 In frontcon at 231 PortRisk = 0.0392 0.0445 0.0559 0.0701 0.0858 0.1023 0.1192 0.1383 0.1661 0.2000 PortReturn = 0.1231 0.1316 0.1402 0.1487 0.1573 0.1658 0.1744 0.1829 0.1915 0.2000 PortWts = 0.7692 0.2308 0 0.6667 0.2991 0.0342 0.5443 0.3478 0.1079 0.4220 0.3964 0.1816 0.2997 0.4450 0.2553 0.1774 0.4936 0.3290 0.0550 0.5422 0.4027 0 0.6581 0.3419 0 0.8291 0.1709 0 1.0000 0
The output data is represented row-wise. Each portfolio's risk, rate of return, and associated weights are identified as corresponding rows in the vectors and matrix.
For example, you can see from these results that the second portfolio has a risk of 0.0445, an expected return of 13.16%, and allocations of about 67% in the first asset, 30% in the second, and 3% in the third.
abs2active
| active2abs
| frontcon
| frontier
| pcalims
| pcgcomp
| pcglims
| pcpval
| portalloc
| portcons
| Portfolio
| portopt
| portvrisk