WebCab Portfolio Demo
v4.2
(J2SE Edition)

webcab.lib.finance.portfolio
Class SolveFrontier

java.lang.Object
  |
  +--webcab.lib.finance.portfolio.SolveFrontier
All Implemented Interfaces:
Serializable

public class SolveFrontier
extends Object
implements Serializable

Within this class we provide methods by which the optimal portfolio can be selected from the Efficient Frontier when the investor describes his investment preferences. The investors preferences can be given in terms of one of the following:

  1. Maximum Risk - The optimal portfolio is selected from the Efficient Frontier by knowing its total risk.
  2. Expected Return - The optimal portfolio is selected from the Efficient Frontier by knowing its expected return.
  3. (Risk) Investors Utility Function - The optimal portfolio(s) is selected from the Efficient Frontier by using the given (Risk) investors Utility function which is a function of the risk.
  4. (Return) Investors Utility Function - The optimal portfolio(s) is selected from the Efficient Frontier by using the given (Return) investors Utility function which is a function of the expected return.

Remark: Since the Efficient Frontier is monotonically increasing in the risk and expected return a given value of the risk or expected return will determine a unique portfolio if the given Efficient Frontier takes the given values of the expected return and risk at some point. However, knowledge of the investors Utility function does not guarantee the existence of a corresponding optimal portfolio.

Selecting a Portfolio from the Efficient Frontier when its risk or expected return is known

Once we are provided with either the maximum risk or the expected returns we are able to select the corresponding portfolio from the Efficient Frontier using one of:

  1. Solve for a given maximum risk using findReturn(double, double[], double[]) - The maximum risk which the investor will accept is given and then the weights and the expected return of the Efficient Frontier is returned. Once the Efficient Frontier is known you are able to evaluate the (possibly constrained) weights of the corresponding portfolio by calling the method Markowitz.efficientFrontier(double, double[][], double[], double) or its stateful version Markowitz.efficientFrontier(double, int), if the Efficient Frontier be been pre-evaluation.
  2. Solve for a given expected return using findRisk(double, double[], double[]) - The expected return of the portfolio which the investor requires is given and then the risk of the corresponding Efficient Frontier is returned. That is, the portfolio with the lowest risk from the given expected return required. If you require to know the corresponding weights of the asset of this portfolio then you can use the method Markowitz.efficientFrontier(double, double[][], double[], double) or its stateful version Markowitz.efficientFrontier(double, int), if the Efficient Frontier be been pre-evaluation.

Selecting a Portfolio from the Efficient Frontier when the Utility function in known

Depending on whether you are provided of the Utility function which is a function of the expected return or the risk you should use of the following methods in order to evaluate the risk or expected return of the optimal portfolio(s) (if it exists) on the Efficient Frontier:

  1. (Risk) Utility Function - Use findRisk(double[], double[], double[], double[], double) in order to evaluate the risk of the optimal portfolio (if it exists) on the Efficient Frontier.
  2. (Return) Utility Function - Use findReturn(double[], double[], double[], double[], double) in order to evaluate the return of the optimal portfolio (if it exists) on the Efficient Frontier.

Once the expected return or the risk of the Efficient Frontier is known you will be able to evaluate the asset weights and other properties of the optimal portfolio. The advantage here over the methods provided within the Markowitz class is that we are able to provide a Utility function which is a function of the risk or the return rather than only of the return.

Internal Interpolation Algorithm used

Within this class we use cubic spline interpolation in order to interpolate the Efficient Frontier around the finite set of points at which it is evaluated using the method Markowitz.efficientFrontier(double, double[][], double[], double)

Internal Equation Solver Algorithm used

Internally within this class we use the Interval bisection method which allows the solution of equations of one variable to be found. In this instance since the Efficient Frontier is a continuous function defined over a finite interval (of risk and return) this approach will always produce a solution to a given degree of accuracy.

Finding the Asset Weights when the Risk and Expected Return is known

Whether you know the expected risk which to the investor will accept or the expected return desired you will determine a unique portfolio on the Efficient Frontier constructed from the available assets. Here we details how you are able to find the assets weights of this given portfolio on the Efficient Frontier.

If the expected return which the investor requires is known then the weights of the corresponding portfolio can be evaluated using Markowitz.efficientFrontier(double, double[][], double[], double). If the risk is known then the corresponding unique expected return should be evaluated using the method findReturn(double, double[], double[]). Once the corresponding expected return is known the same procedure can be applied using Markowitz.efficientFrontier(double, double[][], double[], double), in order to find the corresponding weights of the portfolio with the given maximum risk.

See Also:
Serialized Form

Constructor Summary
SolveFrontier()
          Creates a new instance.
 
Method Summary
 double findReturn(double[] riskUtility, double[] returnUtility, double[] riskAtPoints, double[] returnAtPoints, double precision)
          Evaluates a value of the expected return of the portfolio on the Efficient Frontier which is optimal with respect to the investors (Return) Utility function which is a function of the expected return.
 double findReturn(double risk, double[] riskAtPoints, double[] returnAtPoints)
          Evaluates the expected return of a portfolio on the efficient frontier which has a given level of risk.
 double findRisk(double[] riskUtility, double[] returnUtility, double[] riskPoints, double[] returnPoints, double precision)
          Evaluates a value of the risk of the portfolio on the Efficient Frontier which is optimal with respect to the investors (Risk) Utility function which is a function of risk.
 double findRisk(double expectedReturn, double[] riskPoints, double[] returnPoints)
          Evaluates the risk of the portfolio on the Efficient Frontier which has a given expected return.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SolveFrontier

public SolveFrontier()
              throws ReferencedServiceException
Creates a new instance.

Method Detail

findRisk

public double findRisk(double expectedReturn,
                       double[] riskPoints,
                       double[] returnPoints)
                throws InterpolationException,
                       ReferencedServiceException,
                       SolveFrontierDemoException
Evaluates the risk of the portfolio on the Efficient Frontier which has a given expected return.

Remarks:

  1. Since the Efficient Frontier is monotonically increasing in risk against return any possible value of the expected return will correspond on a unique value of the risk of the portfolio on the Efficient Frontier.
  2. For details concerning how to evaluated the weights of the assets within the portfolio on the Efficient Frontier with a given maximum risk please see the SolveFrontier class API documentation.

Notes on the input Parameters

A set of points on the Efficient Frontier should be evaluated using methods from the Markowitz class, in particular:

  1. riskPoints - the values of the (known) risk points on the Efficient Frontier are evaluated using the method Markowitz.portfolioRisksEfficientFrontier(double[][])
  2. returnPoints - the values of the (known) return points on the Efficient Frontier are evaluated using the method Markowitz.expectedReturnEfficientFrontier()

Note: Alternatively you may choose to use the complex type PointsOnEfficientFrontier, and the related methods from the portfolio class in order to find the set of points on the efficient frontier for which it is evaluated.

Parameters:
expectedReturn - the value of the expected return of the portfolio on the Efficient Frontier for which the risk will be evaluated.
riskPoints - an array of doubles where the first term is the lowest value of the risk from the set of points at which the Efficient Frontier is known, the second term is the next lowest value of the risk and so on.
returnPoints - an array of doubles where the first term is the lowest value of the return from the set of points at which the Efficient Frontier is known, the second term is the next lowest values of the return and so on.
Throws:
InterpolationException - thrown when there does not correspond a point on the interpolation function corresponding to the parameters given.
ReferencedServiceException - thrown if an error occurs while invoking methods of another class.
SolveFrontierDemoException
See Also:
findRisk(double[], double[], double[], double[], double) - evaluates the value of the risk on the Efficient Frontier where the expected return desire is given as a function of the risk. If this function is a constant function in risk then it reduces to the special case implemented here.

findRisk

public double findRisk(double[] riskUtility,
                       double[] returnUtility,
                       double[] riskPoints,
                       double[] returnPoints,
                       double precision)
                throws SolveFrontierException,
                       InterpolationException,
                       SolveFrontierDemoException
Evaluates a value of the risk of the portfolio on the Efficient Frontier which is optimal with respect to the investors (Risk) Utility function which is a function of risk. Once the risk is known then the corresponding value of the expected return can be evaluated using the method findReturn(double, double[], double[]).

Notes on the Efficient Frontier input parameters

A set of points on the Efficient Frontier should be evaluated using methods from the Markowitz class, in particular:

  1. riskPoints - the values of the (known) risk points on the Efficient Frontier are evaluated using the method Markowitz.portfolioRisksEfficientFrontier(double[][])
  2. returnPoints - the values of the (known) return points on the Efficient Frontier are evaluated using the method Markowitz.expectedReturnEfficientFrontier()

Note: Alternatively you may choose to use the complex type PointsOnEfficientFrontier, and the related methods from the portfolio class in order to find the set of points on the efficient frontier for which it is evaluated.

The parameters of the Investors Utility Function

The (Risk) Utility function is given by a set of points which lie on the Utility curve. The (Risk) Utility function is assumed to take the same range of values of the risk parameter as the range of the risk over which the efficient frontier is defined. It is essential within the formation of this approach that the (Risk) Utility function is a function of risk. In particular, if we are given a value of the risk then there corresponds a unique value of the expected return. In practice, since we are applying Cubic spline method in order to interpolate the (Risk) Utility function from a finite set of points it is enough to ensure that from this finite set of points there does not exist two distinct points which have the same value of the risk.

Advantages of a General Utility Function

A more general Utility function allows the investor to express the likely fact that as the risk increase they desirer a higher expected level of return. In the case when the (Risk) Utility function returns a constant value of the expected return this methods reduced to the case considered in findRisk(double, double[], double[]).

Parameters:
riskUtility - an array of double where the first term is the lowest value of the risk from the set of points at which the investors risk/reward Utility function is given, the second term is the next lowest value of the risk and so on.
returnUtility - an array of double where the first term is the lowest value of the expected return from the set of points at which the investors risk/reward Utility function is given, the second term is the next lowest value of the expected return and so on.
riskPoints - an array of doubles where the first term is the lowest value of the risk from the set of points at which the Efficient Frontier is known, the second term is the next lowest value of the risk and so on.
returnPoints - an array of doubles where the first term is the lowest value of the return from the set of points at which the Efficient Frontier is known, the second term is the next lowest values of the return and so on.
precision - the precision for which the value of the risk of an optimal portfolio will be returned. Since there may be more than one optimal portfolio we used the term `an optimal'. In particular, if the precision is set to 0.001 then the risk will be returned to within 0.001 etc, of the `exact' solution.
Throws:
InterpolationException - thrown when there does not correspond a points on the interpolation function corresponding to the parameters given.
SolveFrontierException - thrown if no value is found for the given input parameters.
SolveFrontierDemoException
See Also:
findRisk(double, double[], double[]) - this is a special case of this method which corresponds to the case where the (Risk) Utility function is a constant function which states that the investor requires a given expected return and is not influenced by the level of risk.

findReturn

public double findReturn(double risk,
                         double[] riskAtPoints,
                         double[] returnAtPoints)
                  throws InterpolationException,
                         ReferencedServiceException,
                         SolveFrontierDemoException
Evaluates the expected return of a portfolio on the efficient frontier which has a given level of risk.

Remark:

  1. Since the Efficient Frontier is monotonically increasing in risk against return any possible value of the expected return will correspond on a unique value of the risk of the portfolio on the Efficient Frontier.
  2. For details concerning how to evaluated the weights of the assets within the portfolio on the Efficient Frontier with a given expected return please see the SolveFrontier class API documentation.

Notes on the input Parameters

A set of points on the Efficient Frontier should be evaluated using methods from the Markowitz class, in particular:

  1. riskPoints - the values of the (known) risk points on the Efficient Frontier are evaluated using the method Markowitz.portfolioRisksEfficientFrontier(double[][])
  2. returnPoints - the values of the (known) return points on the Efficient Frontier are evaluated using the method Markowitz.expectedReturnEfficientFrontier()

Note: Alternatively you may choose to use the complex type PointsOnEfficientFrontier, and the related methods from the portfolio class in order to find the set of points on the efficient frontier for which it is evaluated.

Parameters:
risk - the value of the portfolio risk of a portfolio on the efficient frontier for which the corresponding expected return will be evaluated.
Throws:
InterpolationException - thrown when there does not correspond a points on the interpolation function corresponding to the parameters given.
ReferencedServiceException - thrown if an error occurs while invoking methods of another class.
SolveFrontierDemoException
See Also:
findReturn(double[], double[], double[], double[], double) - evaluates the value of the expected return on the Efficient Frontier when the maximum risk is given as a function of the expected return. If this function is a constant function in the expected return then this methods reduces to the special case implemented here.

findReturn

public double findReturn(double[] riskUtility,
                         double[] returnUtility,
                         double[] riskAtPoints,
                         double[] returnAtPoints,
                         double precision)
                  throws SolveFrontierException,
                         InterpolationException,
                         SolveFrontierDemoException
Evaluates a value of the expected return of the portfolio on the Efficient Frontier which is optimal with respect to the investors (Return) Utility function which is a function of the expected return. Once the expected return is known the corresponding value of the risk of the portfolio can be evaluated using the method findRisk(double, double[], double[]).

Notes on the Efficient Frontier input parameters

A set of points on the Efficient Frontier should be evaluated using methods from the Markowitz class, in particular:

  1. riskPoints - the values of the (known) risk points on the Efficient Frontier are evaluated using the method Markowitz.portfolioRisksEfficientFrontier(double[][])
  2. returnPoints - the values of the (known) return points on the Efficient Frontier are evaluated using the method Markowitz.expectedReturnEfficientFrontier()

Note: Alternatively you may choose to use the complex type PointsOnEfficientFrontier, and the related methods from the portfolio class in order to find the set of points on the efficient frontier for which it is evaluated.

The parameters of the Investors Utility Function

The (Return) Utility function is given by a set of points which lie on the utility curve. The (Return) utility function is assumed to take the same range of values of the expected return parameter as the range of the expected return over which the Efficient Frontier is defined. It is essential within the formation of this approach that the (Return) Utility function is a function of the expected return. In particular, if we are given a value of the return then there corresponds a unique value of the risk. In practice, since we are applying a Cubic spline method in order to interpolate the (Return) Utility function from the finite set of points it is enough to ensure that from this set of points there does not exist two distinct points with have the same value of the return.

Advantages of a General Utility Function

A more general Utility function allows the investor to express the likely fact that as the expected return increase they may except a higher level of risk. In the case when the (Return) Utility function returns a constant value of the risk this methods reduced to the case considered in findReturn(double, double[], double[]).

Parameters:
riskUtility - an array of double where the first term is the lowest value of the risk from the set of points at which the investors risk/reward utility function is given, the second term is the next lowest value of the risk and so on.
returnUtility - an array of double where the first term is the lowest value of the expected return from the set of points at which the investors risk/reward utility function is given, the second term is the next lowest value of the expected return and so on.
precision - the precision for which the value of the risk of an optimal portfolio will be returned. Since there may be more than one optimal portfolio we used the term `an optimal'. In particular, if the precision is set to 0.001 then the risk will be returned to within 0.001 etc, of the `exact' solution.
Throws:
SolveFrontierException - thrown if no value is found for the given input parameters.
InterpolationException - thrown when there does not correspond a points on the interpolation function corresponding to the parameters given.
SolveFrontierDemoException
See Also:
findReturn(double, double[], double[]) - this is a special case of this method which corresponds to the case where the (Return) Utility function is a constant function which states that the investor will accept of given maximum risk and is not influence by the corresponding level of expected return.

WebCab Portfolio Demo
v4.2
(J2SE Edition)