Can I get the returns before calculating the covariances for the 9 stocks XLB , …historical data you have got from google finance.

I am a mathematician and I am developing an active set method for portfolio optimization with Sum of Weights Equal to One and No Shorting.

So that I can compare the answer I will get with your answer:

[1] 0.0000000 0.4100454 0.0000000 0.0000000 0.0000000 0.3075880 0.0000000

[8] 0.2823666 0.0000000

I have another question on argument-setting though. What if my goal was to maximize the expected return given a max-limit on the portfolio variance? How can I set the arguments? ]]>

Hi CG,

This was more of a one-off and was written several years ago. As such, it’s been lost in the ether.

I’m pretty busy these days, but whenever I find the chance, I might try to recreate it (and honestly reacquaint myself with it).

Best of luck!

Mr. T

This post is truly exceptional! Thanks for writing it. in the case of weights being above 1, what if I wanted not to apply a constraint but a linear penalty?

Said differently, I am willing to go above 1 when it comes to my total sum of weights only if it is very beneficial. For that reason a linear penalty would likely do the trick.

Any ideas there? ]]>

Hi,

Thanks for the compliment!

Good point! I’ll respond with a hedged yes/no.

Yes, in that if you were pedantic in interpreting everything in their right units, you could say, “well, I only want half of the variance to contribute” (setting the risk-aversion parameter to 0.5).

No, in that in practice, the risk-aversion parameter is a hyper parameter you search over so the lack of multiplied-by-two gets glossed over. What I mean is that you’d permute your risk-aversion parameter, simulate/test over those permutation over some validation period, and “pick” one for which you were satisfied with the trading characteristics (whatever it may be).

All that being said, I think I’ll go ahead and change it just to cross-my-t’s-and-dont-my-i’s.

]]>(1/2)*x^T*Q*x – d^T*x

and we’re minimizing

x^T * Sigma * x – mu^T*x

shouldn’t we use Dmat = 2*Sigma, instead of Dmat = Sigma as you suggest?

Again, thanks for the post!

]]>