Skip to content
Numerical Method , home
Menu

Writing2013

Mean-Variance Portfolio Optimization When Means And Covariances Are Unknown

[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.

efficient frontier

efficient frontier

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 weffw_{eff} is given by

weff=arg⁡min⁡wwTΣw subject to wTμ=μ∗,wT1=1w_{eff}=\arg \min_w w^T \Sigma w \text{ subject to } w^T\mu = \mu_*, w^T1 = 1

where μ\mu is the expected future returns, and Σ\Sigma is the expected covariance matrix of future returns. This problem is readily solved by quadratic programming.

Nonetheless, the assumption that μ\mu and Σ\Sigma 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 μ^\hat{\mu} and Σ^\hat{\Sigma}, 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 Σ\Sigma [Fan, Fan and Lv, 2008]. The second approach uses Bayes or other shrinkage estimates of Σ\Sigma [Ledoit and Wolf, 2004]. Both approaches attempt to use improved estimates of Σ\Sigma for the plug-in efficient frontier. They have also been modified to provide better estimates of μ\mu, for example, in the quasi-Bayesian approach of [Black and Litterman, 1990]. The third approach uses bootstrapping to correct for the bias of w^eff\hat{w}_{eff} as an estimate of weff.w_{eff}.

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 r1,…,rnr_1, \ldots, r_n,

maximize {E(wTrn+1)−λVar(wTrn+1)}\left \{ E(w^Tr_{n+1}) - \lambda Var(w^Tr_{n+1}) \right \}

where wTrn+1w^Tr_{n+1} is now regarded as a random variable conditional on the past returns, and λ\lambda is a risk-aversion index (investor’s preference).

This stochastic optimization problem is not standard due to the E(.)2E(.)^2 term in Var(.)Var(.) (Var(X)=E[X2]−(E[X])2Var(X) = E[X^2] - (E[X])^2). To tackle this problem, the authors solve instead an equivalent stochastic optimization problem:

max⁡ηE[wT(η)rn+1]−λVar[wT(η)rn+1]\max_{\eta} {E[w^T(\eta)r_{n+1}] - \lambda Var[w^T(\eta)r_{n+1}]}

where

w(η)=arg⁡min⁡wλE[(wTrn+1)2]−ηE(wTrn+1)w(\eta) = \arg \min_w {\lambda E[(w^Tr_{n+1})^2] - \eta E(w^Tr_{n+1}) }

and

η=1+2λE(WB)\eta = 1 + 2\lambda E(W_B)

Next, define the function

Cλ,μn,Vn(η)=E[wT(η)μn]+λ(E[wT(η)μn])2−λE[wT(η)Vnw(η)]C_{\lambda,\mu_n,V_n}(\eta) = E[w^T(\eta)\mu_n] + \lambda (E[w^T(\eta)\mu_n])^2 - \lambda E[w^T(\eta) V_n w(\eta)]

where μn\mu_n and VnV_n are the first and second moments of returns. The problem now becomes maximizing Cλ,μn,Vn(η)C_{\lambda,\mu_n,V_n}(\eta) 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 μn\mu_n and VnV_n to plug into Cλ,μn,Vn(η)C_{\lambda,\mu_n,V_n}(\eta). μn\mu_n can be estimated by, for example, bootstrapping, a multi-factor model, a GARCH model, etc. Similarly, Vn=Σ+μnμnTV_n = \Sigma + \mu_n \mu_n^T can be estimated by first estimating the sample covariance matrix Σ\Sigma. As Σ\Sigma 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:

  1. Estimate μn\mu_n and VnV_n from past returns
  2. Estimate a=E[wT(η)μn],b=E[wT(η)Vnw(η)]a = E[w^T(\eta)\mu_n], b = E[w^T(\eta)V_nw(\eta)]
  3. Construct the univariate real function Cλ,μn,Vn(η)=a+λa2−λbC_{\lambda,\mu_n,V_n}(\eta) = a + \lambda a^2 - \lambda b
  4. Maximize Cλ,μn,Vn(η)C_{\lambda,\mu_n,V_n}(\eta) over η\eta
  5. Compute the optimal weighting w∗=w(η∗)w^* = w(\eta^*) using the optimal η∗\eta^*

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 C(η)C(\eta).

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).

Code

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.

Responses 4

Archived · closed

  1. Haksun Li 2013-02-16 at 2:07 pm

  2. marcus 2014-05-05 at 2:12 pm

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

  3. Haksun Li 2014-05-21 at 3:17 pm

    I use Chrome.

  4. Ken 2014-05-22 at 5:00 am

    Both Chrome and Firefox work fine.