# Mean-variance portfolio returns illogical weights

I have a dataset with 5 assets.

I apply mean-variance portfolio:

  In<-rep(1,5) #identity vector
delta <- 5 #risk aversion parameter
covariance<-cov(sample.data) #covariance matrix
mu <- colMeans(sample.data) #mean returns
mu <- t(t(mu))

#I calculate the standard mean-variance weights:
xt <- 1/delta* solve(covariance) %*% mu
m.w <- as.vector(xt) / In %*% xt %*% t(In)


My problem is that sometimes it can happen that the denominator: In %*% xt #%*% t(In) is a negative number.

Let us take the following example with 5 assets:

Mean returns: 6, 6, 1, 1, 1
Standard deviation of returns: 1, 1, 1, 1, 1


Portfolios with a mean of 6 are clearly superior, but the mean-variance calculation sometimes ends up putting large negative weights on the better assets.

This happens for the following reason:

Calculating xt results in:

5.264789 6.134487 -5.267289 -3.337918 -2.79493

The denominator (In %*% xt #%*% t(In)) is:

-0.0008615427 -0.0008615427 -0.0008615427 -0.0008615427 -0.0008615427

Since this denominator is negative and a really small number, the final weights end up being:

-6110.886 -7120.352 6113.787 3874.351 3244.1


Clearly this should be the other way round.

What am I missing?

EDIT: noob2 suggested that the problem might be that the covariance matrix is slightly negative definite, but it's not:

> eigen(covariance)
$values  4.90387493 0.12627889 0.11649928 0.09035977 0.07858112$vectors
[,1]       [,2]       [,3]        [,4]        [,5]
[1,] -0.4529396  0.7235119 -0.1188464 -0.01716486 -0.50690946
[2,] -0.4664390 -0.2146771 -0.1914489 -0.81623850  0.18289445
[3,] -0.4511018 -0.6111482 -0.3089085  0.39903609 -0.41030564
[4,] -0.4289843  0.2157315 -0.2459586  0.41078039  0.73498045
[5,] -0.4356145 -0.1019909  0.8906754  0.07409282  0.03233327


Here's some example data with the properties described above:

https://www.dropbox.com/s/t3212c5sq7w1uug/example.Rdata?dl=0

There are a couple of possibilities here. First, any "efficient" portfolio created using this algorithm can always be stochastically dominated, which implies, of course that it is impossible for it to be the efficient frontier. This is a well known defect of the model. In fact, you can prove, knowing only that, that the CAPM is a statistically invalid model in all circumstances. Most people do not have enough of the statistical fundamentals to actually know that. Using basic theorems in statistics, it is possible to show that the model specifications are always invalid.

The second is that your implied mean and standard deviation from your data are ranked in such a way that low risk stocks can get high returns and high risk stocks can get low returns. Your specific example would always cause a CAPM to fail because there is an implicit simple ordering requirement in the algorithm. Your example ties the variances, which violates a simple ordering. Your example, if the CAPM were correct, would be impossible. An error in the risk-free rate would also violate this ordering.

There is also a recent paper that derives the actual distribution of all asset classes. The distribution in either raw form or log-log form has no covariance matrix. The assets can co-move, but will violate the definition of covariance.

This implies that the covariance structure that the model is dependent on cannot mathematically happen, which in part explains the empirical stochastic dominance observed in the real world.

In 1963, Benoit Mandelbrot showed that the CAPM could not be true, empirically, but that claim has never stuck because no one could figure out why his observations should happen. Now that the distribution is known, it is obvious why his observations happened.

You can start with Mandelbrot's original paper. The Variation of Certain Speculative Prices, Benoit Mandelbrot, The Journal of Business, Vol. 36, No. 4 (Oct., 1963), pp. 394-419

• Thanks that's very interesting. Does this mean that The algorithm will break whenever there is at least one asset that clearly dominates the others? For example one asset with mu=6 and sd=1 VS. mu=1 and sd=1. In this case one option has a larger mean but same risk compared to the other. Is there any formula that I could use to determine under what conditions would the algorithm break? For example what if I have one asset with mu=1, sd=1 VS mu=6, sd=6, in this case the high mean option also has higher risk. Can you tell me what is the recent paper dealing with this?I am checking Hanoch&Levy now – tzi Nov 30 '16 at 11:38
• Actually, what I said is that it is always broken, even with proper orderings. You can always construct a dominating portfolio, even when the is perfect. There is always a convex combination of assets that dominates the efficient frontier at every point. I'll look for a reference later today. – Dave Harris Nov 30 '16 at 14:40
• But there must be at least some class of assets for which mean-variance will give weights that are reasonable (e.g. putting higher weight on the higher return asset). From some point it will start giving non-sensical weight (huge negative weights on the better options, as in my example). I would like to know how I can anticipate this point. For example if I have two assets (mu=1,sd=1 and mu=2,sd=1), here the algorithm still gives reasonable weights. But if I increase mu for one of the options, it starts to give non-sensical weights. How can one tell which scenario will happen? Thanks! – tzi Nov 30 '16 at 14:47
• You cannot because you are imposing a purely subjective decision function on Pearson and Neyman's implicit cost function, which is intended to be "objective." You can construct seemingly silly weights with relative ease using real data. That is sort of how I came to realize something was amiss and that motivated me to quit financial institutions and get a doctorate. CAPM is a rigid construction in the Pearson-Neyman school of statistics. Such methods are not coherent, which is a technical term meaning you cannot place gambles based on the models, ever. – Dave Harris Nov 30 '16 at 14:57
• I completely agree with you and I'm not a big believer of any of these models. I'm just thinking that they must work in some ideal world (e.g. all options normally distributed with mu=1,sd=1. I am trying to work within the bounds of this ideal world and trying to find its limits. – tzi Nov 30 '16 at 15:13

this probably means that the risk-free rate is too high. If the risk-free rate is greater than the expected return of the minimal variance portfolio, the algorithm breaks and you end up with an optimally inefficient portfolio instead of an optimally efficient one.

• Thanks for your answer! Does this mean that the standard deviation of the high-mean asset should be higher - in theory - compared to the standard deviation of the other assets? How could I tell what standard deviation the high-mean asset should have in order to be lower than the expected return of the minimum variance portfolio? Or is there any general formulate that would tell me in what situations the algorithm breaks down? – tzi Nov 28 '16 at 21:14
• Hard to say what the problem is from the info available. It seems you dont have a risk free asset, right? You are trying to find the optimum combination of risky assets. Possibly the covariance matrix is close to singular. – noob2 Nov 29 '16 at 3:13
• @noob2: yes that's actually true. The assets have different means (6 vs 1) but all have a standard deviation of 1. Does that help? – tzi Nov 29 '16 at 7:58
• We know that when the weights are unconstrained the algorithm will sometimes put big positive weights on some assets and big negative weights on others. But I don't know what to add beyond that. – noob2 Nov 29 '16 at 10:01
• The first order condition is the same for a max or a min. My guess is that your covar matrix is (slightly) negative definite, due to roundoff error or other reasons. So the solution you are finding is actually a min, that is why the high return assets are being shorted and the low return assets are being bought. – noob2 Nov 29 '16 at 10:38