[Lai, Xing and Chen, 2010], in the paper “Mean-Variance Portfolio Optimization When Means And Covariances Are Unknown”, proposed a ground breaking method to do portfolio optimization. In what follows we summarize their idea and use it to implement a periodic rebalancing strategy based on the AlgoQuant framework.

Harry Markowitz won the Nobel prize for his work in mean-variance (MV) portfolio optimization in 1950s. The theory is widely regarded as fundamental in financial economics. It says, given a target return of a portfolio of m assets, the optimal (in terms of information ratio) weighting is given by

where is the *expected future* returns, and is the *expected* covariance matrix of *future* returns. This problem is readily solved by *quadratic programming*.

Nonetheless, the assumption that and are known in advance is very dubious. This has been referred to as the “Markowitz optimization engima”. The attempts made so far are to better forecast these estimators, namely and , as accurately as possible. The maximum likelihood estimate (MLE) from the training sample is an example. It turns out, however, that MLE performs poorly because the estimators are quite different from the realized values [Michaud, 1989]. Since then, three approaches have been proposed to address the difficulty. The first approach uses a multi-factor model to reduce the dimensionality in estimating [Fan, Fan and Lv, 2008]. The second approach uses Bayes or other shrinkage estimates of [Ledoit and Wolf, 2004]. Both approaches attempt to use improved estimates of for the plug-in efficient frontier. They have also been modified to provide better estimates of , for example, in the quasi-Bayesian approach of [Black and Litterman, 1990]. The third approach uses bootstrapping to correct for the bias of as an estimate of

The innovation in [Lai, Xing and Chen, 2010] is to move away from the traditional approach of finding better estimators. They instead assume inherent uncertainty, hence risk, in these estimators. In other words, because the mean and covariance matrix of *future returns* are estimated from past returns, the **uncertainties of these estimators** should be incorporated into the portfolio **risk**. The authors formulate a **stochastic optimization framework** which solves a more fundamental problem. Given the past returns ,

maximize

where is now regarded as a random variable conditional on the past returns, and is a *risk-aversion index* (investor’s preference).

This stochastic optimization problem is not standard due to the term in (). To tackle this problem, the authors solve instead an equivalent stochastic optimization problem:

where

and

Next, define the function

where and are the first and second moments of returns. The problem now becomes maximizing which can be achieved by any univariate maximization algorithm such as Brent’s method (BrentMinimizer in SuanShu can be used to minimize the negative of this function).

The remaining task is to estimate and to plug into . can be estimated by, for example, bootstrapping, a multi-factor model, a GARCH model, etc. Similarly, can be estimated by first estimating the sample covariance matrix . As may be unstable when the sample size is small, our implementation uses a covariance-shrinkage method described in [Ledoit and Wolf 2004].

Putting all these steps together, the algorithm to compute the optimal weighting looks like this:

- Estimate and from past returns
- Estimate
- Construct the univariate real function
- Maximize over
- Compute the optimal weighting using the optimal

We have implemented this algorithm in AlgoQuant as a component/module/signal. Using our component based programming paradigm, it is easy to modify the steps in the implementation without a lot of changes to the code. For instance, we can pass in the constructor of `Lai2010NPEBModel`

a `GridSearchCetaMaximizer`

object instead of a `BrentCetaMaximizer`

object to change the algorithm to maximize .

In addition, we have coded up a trading strategy using Lai’s portfolio optimization algorithm as a signal. This strategy re-balances periodically a basket of assets according to the optimal weighting computed by the model. Specifically, `onDepthUpdate()`

, collects the returns series using the component `ReturnSeries`

with its `update()`

method. Then, `onTimerUpdate()`

is triggered periodically (say, every 3 months) to call the model (passing in the returns matrix) and to send orders to re-balance the assets accordingly. We backtest this trading strategy using the `Simulator`

object together with the historical data from Yahoo! Finance (or other data sources).

An online demonstration can be found here.

### References

- Black, F. and Litterman, R. (1990). Asset Allocation: Combining Investor Views with Market Equilibrium. Goldman, Sachs & Co., New York.
- Fan, J, Fan, Y and Lv, J. (2008). High dimensional covariance matrix estimation using a factor model. J. Econometrics 147 186-197.
- Lai, T. L., Xing, H. and Chen Z. (2010). Mean-variance portfolio optimization when means and covariances are unknown. Annals of Applied Statistics 2011, Vol. 5, No. 2A, p. 798-823.
- Ledoit, P. and Wolf, M. (2004). Honey, I shrunk the sample covariance matrix. J. Portfolio Management 30 110–119.
- Michaud, R. O. (1989). Efficient Asset Management. Harvard Business School Press, Boston.

The demo source code is here:

http://redmine.numericalmethod.com/projects/public/repository/svn-algoquant/entry/core/src/main/java/com/numericalmethod/algoquant/model/portfoliooptimization/lai2010/Lai2010NPEBModelDemo.java

Can you tell what browser I should use in order to show those math equations properly?Many thanks

I use Chrome.

Both Chrome and Firefox work fine.