Markowitz suggests in his Nobel Prize-winning paper *Markowitz(1952)* that when one selects a portfolio, he/she should consider both the return and the risk of the portfolio. Most of us, if not all, are risk-averse. Risk-averse means that if there are two portfolios with the same return, but different risks (in this article by risk we mean the standard deviation of the portfolio), we would choose the one with the smaller risk without any hesitation. Therefore given a set of risky assets and an expected return, we are interested in finding their best combination, i.e. the weights which will minimize the risk of the portfolio. And if we find the minimum risk of the portfolio for any return, we can draw a curve on risk-return plane. This curve is the famous efficient frontier.

Assuming there are risky assets, and their return vector and covariance matrix are and respectively, then the points on the efficient frontier are computed by solving the following problem:

where is the pre-defined expected return, and is the weight vector. The above problem can be solved using Lagrange multipliers. And we denote this problem as “Problem 1”.

In AlgoQuant, we use another approach to compute the efficient frontier. The problem we solve is based on the utility function:

, , and are the same parameters in Problem 1. The newly added parameter , is risk-averse coefficient. And this problem is denoted as “Problem 2”.

The larger the , the less risk the investor is willing to take. Although most of us are risk-averse, the degrees of risk-averse are different among individuals. As a result, a coefficient that describes the risk-averse degree is introduced. Note that in some papers, risk tolerance coefficient is used, for example *Steinbach (2001)*. Risk tolerance is the reciprocal of risk-averse and it is applied on the return term in the objective function rather than the risk term. For usages of risk-averse coefficient in portfolio optimization, please see page 75 of *Lee and Lee (2010)*, and page 159 of *Bodie et al. (2008)*.

It can be seen that Problem 2 and Problem 1 are equivalent. Because with the constraint , the second term in Problem 2’s objective function is a constant, and it does not affect the optimization result. If problem 2 and problem 1 are equivalent, why even bother including the risk-averse coefficient?

When computing the efficient frontier, the two problems are equivalent. However the solutions of the two problems will be different when the constraint is removed.

Problem 1′:

Problem 2′:

The solution of Problem 1′ is the minimum variance portfolio. And minimum variance portfolio is the portfolio on the efficient frontier which has the minimum variance (i.e., the leftmost point on the curve). On the other hand, the solution of Problem 2′ is the optimal portfolio given utility function . This optimal portfolio is also on the efficient frontier. Thus different can lead to different optimal portfolios on the efficient frontier. When is infinity, the return term in the objective function would be 0 comparing to the risk. It means that the only consideration in portfolio optimization is the risk. Thus the portfolio corresponding to is the minimum variance portfolio. When is decreasing to 0, the significance of the risk term in the objective function is also decreasing. And the corresponding portfolio is moving in the upper right direction along the efficient frontier. Finally when is 0, we are just maximizing expected return, without any constraints on the risk.

From the above discussion, it can be seen that changing in Problem 2′ can also find the efficient frontier. However this is not the approach used in AlgoQuant. Because the point movements on the curve are very slow when increases. For example, portfolios corresponding to and are very close on the efficient frontier. As a result, changing expected return in Problem 2 is more convenient to draw the efficient frontier.

When is unknown, AlgoQuant provides a method to find the optimal . In AlgoQuant, *MarkowitzPortfolio* class, there is a method called *getOptimalRiskAversionCoefficient*. This method will try different risk-averse coefficients and select the one whose corresponding optimal portfolio has the largest Sharpe ratio, given a risk free rate. And the corresponding portfolio is the tangency portfolio on the efficient frontier.

So far three different portfolios have been discussed: the minimum variance portfolio, the tangency portfolio and the optimal portfolio. And they have the following connections. The optimal portfolio is found by solving Problem 2′, given a risk-averse coefficient . And every portfolio on the efficient frontier is an optimal portfolio. The optimal portfolio with the largest Sharpe ratio (given a risk free rate) is the tangency portfolio. And finally the optimal portfolio with the smallest risk is the minimum variance portfolio. Moreover the weight corresponding to any one of the optimal portfolios is a linear combination of weights corresponding to the minimum variance portfolio and the tangency portfolio.

By providing an extra input parameter , AlgoQuant is more flexible to give a client a specific optimal portfolio. Because if a client knows his risk-averse coefficient , the optimal portfolio corresponding to can be computed by AlgoQuant. And if he doesn’t, AlgoQuant can always recommend a portfolio on the efficient frontier according to his expected return.

**Reference:**

- Harry Markowitz (1952). Portfolio Selection,
*The Journal of Finance*, Vol. 7, No.1, pp.77-91. - Marc C. Steinbach (2001). Markowitz Revisited: Mean-Variance Models in Financial Portfolio Analysis,
*SIAM Review*, Vol. 43, No. 1, pp. 31-85 - Cheng-Few Lee and John Lee (2010). Handbook of Quantitative Finance and Risk Management, Springer.
- Zvi Bodie, Alex Kane and Alan Marcus (2008). Investments, McGraw-Hill/Irwin, 8th edition.

**Appendix:**

The following code is an example on computing the efficient frontier in AlgoQuant. In this example, Problem 2 is solved with different expected returns and fixed .

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
public void generateFrontierUsingAlgoQuant() throws Exception { System.out.println("generating efficient frontier"); Matrix sigma = new DenseMatrix(new double[][]{ {0.1, 0.03, -0.08, 0.05}, {0.03, 0.2, 0.02, 0.03}, {-0.08, 0.02, 0.3, 0.2}, {0.05, 0.03, 0.2, 0.9} }); final Vector mu = new DenseVector(new double[]{0.08, 0.09, 0.1, 0.11}); double q = 1; double[] expRs = DoubleUtils.seq(0.07, 0.14, 0.005); double[] returns = new double[expRs.length]; double[] stdevs = new double[expRs.length]; int i = 0; final int n = mu.size(); for (final double expR : expRs) { // we constraint the expected return to compute the point // on the frontier WeightConstraints expectedReturnConstraint = getExpReturnConstraint(mu, expR); MarkowitzPortfolio mp = new MarkowitzPortfolio(mu, sigma, expectedReturnConstraint); mp.setRiskAversionCoefficient(q); double ret = mp.getPortfolioReturn(); double stdev = Math.sqrt(mp.getPortfolioVariance()); Vector w = mp.getWeights(); System.out.println("exp return = " + expR); System.out.println("q = " + q); System.out.println("w = " + w); System.out.println("return = " + ret + " = " + w.innerProduct(mu)); System.out.println("stdev = " + stdev + " = " + Math.sqrt(w.innerProduct(sigma.multiply(w)))); returns[i] = ret; stdevs[i] = stdev; i++; } // print out for plotting in Excel System.out.println("Summary:"); System.out.println(" returns = "); for (double ret : returns) { System.out.println(ret); } System.out.println(" stdevs = "); for (double std : stdevs) { System.out.println(std); } } private WeightConstraints getExpReturnConstraint( final Vector mu, final double expR) { return new WeightConstraints() { @Override public LinearGreaterThanConstraints getLinearGreaterThanConstraints() { return null; } @Override public LinearLessThanConstraints getLinearLessThanConstraints() { return null; } @Override public LinearEqualityConstraints getLinearEqualityConstraints() { return new LinearEqualityConstraints( new DenseMatrix( mu.minus(expR).toArray(), 1, mu.size()), new DenseVector(0.)); } }; } |

## Recent Comments