WebCab Portfolio for COM v5.0 Demo

CapitalMarket.CalculateEfficientFrontier Method (Double, Double, Double[,], Double[], Int32, Double)

Constructs the Efficient Fonrtier over a given range of the expected return.

public void CalculateEfficientFrontier(
   double minimumExpectedReturn,
   double maximumExpectedReturn,
   double[,] covarianceMatrix,
   double[] expectedReturns,
   int numberInterpolationPoints,
   double precision
);

Parameters

minimumExpectedReturn
The minimum expected return for which the Efficient Frontier is evaluated. If you require the entire Efficient Frontier to be evaluated then you may set this parameter to be equal to the return of the assets with the minimum return. Note that this parameter should be given as a percentage (i.e. 1 percent = 1).
maximumExpectedReturn
The maximum expected return for which the Efficient Frontier is evaluated. If you require the entire Efficient Frontier to be evaluated then you may set this parameter to be equal to the return of the assets with the maximum return. Note that this parameter should be given as a percentage (i.e. 1 percent = 1).
covarianceMatrix
The covariance matrix of the assets from which the (optimal) portfolio can be constructed. The dimensions of the (symmetric) covariance matrix will be n X n, where n is the number of assets from which the (optimal) portfolio can be constructed.
expectedReturns
The array of the expected returns of the assets from which the portfolios can be constructed. Where the k-th term will correspond to the percentage return (i.e. 1 percent = 1) or the absolute return of the k-th asset from the set of assets from which the Portfolios (on the Efficient Frontier) can be constructed.
numberInterpolationPoints
The number of interpolation points for which the Efficient Frontier is calculated. Note that these interpolation points lie within the interval bound by the minimum and maximum expected returns set and be equally dispersed within this interval. Moreover, in all case one of the interpolation points will lie of the minimum expected return set and another will lie on the maximum expected return set.
precision
This parameters allow the level of the precision required to be set, where the smaller the parameter the (generally) higher the precision. This variable should be chosen between the range 1E-1 and 1E-6. Note as with most numerical procedures the higher the precision the more computationally intensive the algorithm will become. The precision must be set to be a positive number less than 1; where the smaller the number the greater the precision by also the longer the evaluation of the Efficient Frontier will take.

Remarks

In particular, this method calculates a finite number of interpolation points over a given range of the expected returns from which the Efficient Frontier can be constructed. Note that the weights of the assets from which the portfolios on the Efficient Frontier may be constructed may be subject to constraints (see notes below).

Overview

For each interpolation point an optimization algorithm is called in order to construct the optimal portfolio which has the least risk for a given expected return. The optimization algorithm can be computational intensive particularly when linear constraints are required and the portfolios can be constructed from a large number of assets. These interpolation points will then be interpolated in order to construct the Efficient Frontier over the range of expected returns considered. Hence, the computational demands will increase in relation to the number of interpolation points used. However, the more interpolation points used the more precisely the Efficient Frnotier can be constructed.

Constraining the Weights of the Assets of the Efficient Frontier's Portfolios

With our implementation we offer the possibility to constrain the weights of the assets from which the portfolios on the Efficient Frontier are constructed. The constraints on the weights on the portfolios are set by using either:

  1. SetConstraints - To set lower and upper bounds only.
  2. SetAssetWeightsInequalityConstraints and SetAssetWeightsEqualityConstraints - To set inequality and equality linear constraints.
Note that the constraints should be set prior to constructing the Efficient Frontier using these methods and that either uppper and lower bounds or linear constraints should be used (but not both types at the same time).

Below we illustrate how upper and lower bound constraints can be set on the assets weights using SetConstraints. For details concerning how an example using the alternative type of constraints the setting of linear equality and inequality constraints we refer the reader to the documentation accompanying SetAssetWeightsInequalityConstraints and SetAssetWeightsEqualityConstraints.

Assume an investor requires a portfolio selected from n assets which has the lowest risk for a given expected return but also has the requirement that all of the assets must have a weight between 0.05 and 0.1 (i.e. between 5 and 10 percent). In this instance we would need to set the constraints on the assets to be:

lowerBounds = {0.05, 0.05, 0.05,...., 0.05}
upperBounds = {0.1, 0.1, 0.1, ......, 0.1}

where each of the arrays above has n terms, using the method SetConstraints.

Remark: If the constraints are not set then they will take there default values which are 0 and 1, for the lower bound respectively upper bound of each asset. That is, each asset can have a weighting between 0 percent and 100 percent of the entire portfolio.

Selecting the range of the Expected Returns

We allow the user to restrict the range of expected returns over which the Efficient Frontier is evaluated since:

The range over which the Efficient Frontier is constructed in specified by providing as parameters the minimum and maximum of the expected return. Once the range is set, the portfolios on the Efficient Frontier are evaluated at equally dispersed intervals.

Evaluating the Range of the expected returns on the Efficient Frontier

As mentioned before the points on the (constrained) Efficient Frontier correspond to portfolios which can be constructed from a given set of available assets where the sum of the weightings of the assets sum to 1. Therefore, (since the expected return is additive) the range of expected returns will lie within the range of expected returns of the assets. Below we consider the exact range of the value of the expected return for which the (constrained) Efficient Frontier exists.

Within this class we offer two methods MinFrontierReturn and MaxFrontierReturn which evaluate the upper bounds and lower bounds respectively of the range of the expected returns over which the Efficient Frontier exists for the given set of asset considered. If you set the range of expected returns considered to lie outside this range then an exception will be thrown.

Remarks on the Range of expected returns of the Unconstrained Efficient Frontier

If the weights of the assets are not constrained then the range of expected returns (i.e. all possible optimal portfolios) will lie in the continuous range given by:

Remarks on the Range of expected returns of the Constrained Efficient Frontier

In the case where the weights of the assets from which the portfolios on the Efficient Frontier can be constructed are constrained. The range of the expected return for which the constrained Efficient Frontier may exist may not cover the full range of values of expected returns of the assets. The reason being that the asset with the highest (resp. lowest) expected return may have an upper bound in which case you are not able to construct the portfolio solely of this asset because at all time the weights of the assets must sum to 1.

The Range of the Expected Returns and Performance considerations

The way in which you set the range of expected returns considered will depend on the nature of the problem you are considering. If you are considering a portfolio optimization problem in which the portfolio is constructed from a relatively few number of assets (for example, less than 30) then each evaluation of another interpolation points will be very rapid and hence as long as the total number of interpolation points which you wish to use over the total range is reasonable (i.e. less than 30) then the evaluation of the Efficient Frontier will take a few seconds. However, if you are considering a larger number of assets (for example, more than 80) then you may wish to considered only a proportion of the Efficient Frontier (i.e. a smaller range of expected values) so that you will need to evaluate of fewer number of interpolation points in order to construct the Efficient Frontier over that range to the desired level of accuracy.

Remark: The computational time increase in proportion to the number interpolation points returned.

Number of Interpolation Points used to represent the Efficient Frontier

The Efficient Frontier is persisted (i.e. stored) as the collection of points around which it is interpolated. Therefore, the more interpolation points used within this method the more accurately it will be stored. However, within the construction of the Efficient Frontier the main optimization algorithm is called when each interpolation point is evaluated. Therefore, in terms of performance the computational time required for the construction of the Efficient Frontier will increase in proportion to the number of points used.

As a rule of thumb I would suggest that the number of interpolation points used is chosen within the range [5,20]. The rationale being that if less than five interpolation points are used then unreasonable amounts of qualitative information concerning the Efficient Frontier will be lost. Also, if more than twenty interpolation points are used then (generally speaking) no significant improvement in the accuracy will result.

Effect of this method on the CapitalMarket class

All methods within the CapitalMarket class are either directly or indirectly effected by the evaluation of the Efficient Frontier. The reason for this is that the returned values by all methods depend on the Efficient Frontier, moreover the Market Portfolio and then the optimal portfolios accordance to the CAMP require that the Efficient Frontier is constructed.

The methods within this class which are directly effected (in fact, require) the construction and setting of the private fields which make up the Efficient Frontier are:

  1. CalculateEfficientFrontier - Each portfolio on the Efficient Frontier must satisfy the constraints on the assets.
  2. MarketPortfolio - The Market Portfolio itself since selected from the portfolios on the Efficient Frontier must also satisfy the constraints on the assets by which these portfolios can be constructed.

The other methods (and the CAPM in general) of this class rely on the Market Portfolio and therefore are also effected (however indirectly) by the construction of the Efficient Frontier.

Evaluation of the Covariance matrix and Expected Returns

You are required to provide to this method the covariance matrix and the expected returns of the collection of asset from which the portfolio's on the Efficient Frontier are constructed. We provide within the AssetParameters class procedures which assist in there evaluation of the covariance matrix and the expected returns via either an historical or scenario approach.

Remarks on the Precision Used

If you happen to evaluate a set of points (i.e. portfolios) on the Efficient Frontier and after displaying the results found using GetEfficientFrontierExpectedReturns and GetEfficientFrontierPortfolioRisks, the Efficient Frontier is not a smooth convex curve then we advise that the first course of action is to increase the precision used and repeat of the evaluation of the Efficient Frontier.

Exceptions

Exception TypeCondition
NoSolutionExceptionThrown if this method attempts to construct a portfolio on the Efficient Frontier for an expected return for which there does not exist such a portfolio. In such instances the range of expected returns over which the Efficient Frontier is constructed should be reduced. Please see the remarks above on the selection of a suitable range of expected returns.

See Also

CapitalMarket Class | WebCab.COM.Finance.Portfolio Namespace | CapitalMarket.CalculateEfficientFrontier Overload List