In Markowitz' portfolio theory we can construct portfolios with the minimum variance for a given expected return (or vice versa). Across expected risks, this traces out the well-known efficient frontier.

To find the so-called tangency portfolio, we look to solve:

$$\max_x \frac{\mu^T x}{\sqrt{x^T Q x}}$$

Following Tütüncü (section 5.2), this can be reformulated under a change of variables to a simpler quadratic optimisation problem:

$$\min_{y,\kappa} y^T Q y \qquad \text{where} \quad (\mu-r_f)^T y = 1,\; \kappa > 0$$

I've solved the problem and got values for $y$. However.. $\kappa$ is defined in terms of $x$... So, whilst I'm sure this is a stupid question, how do we actually translate the $y$ vector to recover the true portfolio weights $x$??

The only thing I can think of is that I did not include a constraint for $\kappa$. This is for the same reason as above (that it is defined in terms of $x$, and so not available), and because the KKT conditions suggested in this answer also ignore the $\kappa >0$ term.

  • 1
    $\begingroup$ The $\kappa$ must be related to the other variables in the problem, otherwise your formulation does not make much sense. $\endgroup$
    – Alex C
    Apr 5 '18 at 20:45
  • $\begingroup$ I agree; it doesn't make sense to me. $\kappa$ is introduced on p62 of the book linked in the question, and the formulation is at the bottom of the same page, so perhaps I'm missing a nuance in the mathematical derivation, and how the feasible set $\chi$ is defined? $\endgroup$
    – Zac
    Apr 6 '18 at 0:59

The trick is in the transformation of the constraints used to solve the optimisation problem. This can be seen in the definition of the set $\chi^+$ in the two lines following equation 5.4 of Tütüncü. So, for example, the usual budget constraint ($e^Tx = 1$) would be replaced by ($e^Tx - \kappa = 0$). After the addition of that constraint, the solution with the maximum Sharpe ratio is $x^* = \frac{\hat{x}}{\hat{\kappa}}$, where $(\hat{x},\hat{\kappa})$ is the solution to the quadratic programming problem (see bottom of page 62).

  • $\begingroup$ Thanks - I see what you mean about multiplying the constraints by a \kappa term now, which I guess is equivalent to $(x,\kappa) \in \chi^{+}$. Unfortunately, I still don't quite see how to use $\kappa$ to change variables; it seems that we can perhaps pick any value, but the simulation I put together suggests that won't work, as I get different values for different $\kappa$, and the weights don't total 1 as required. I've uploaded the simulation here, using a placeholder $\kappa$: publiccode-zac-keskin.notebooks.azure.com/nb/notebooks/… $\endgroup$
    – Zac
    Apr 6 '18 at 13:04
  • 1
    $\begingroup$ The formulation allows for a variable $\kappa$ that can take any positive value. In your code, you are using $\kappa$ as a constraint in your Lagrangean, when you should be augmenting your solution vector with a $\kappa$. In other words, you should be solving for $(x, \kappa)$ rather than $x$. $\endgroup$ Apr 6 '18 at 14:44
  • $\begingroup$ I think that’s the wrong approach. Your Lagrangean is $L(x, \kappa, \lambda_1, \lambda_2)$, and you should be solving for $(x, \kappa, \lambda_1, \lambda_2)$. Hence, your $A$ matrix should be $ (N+3) \times (N+3)$. There should be an extra row for $ \frac{\partial L}{\partial \kappa} = \lambda_1$. Your $b$ values should be all 0, apart from the $\lambda_2$ entry, which should be 1. $\endgroup$ Apr 6 '18 at 17:44
  • $\begingroup$ Thank you - I think I've roughly done what you suggest, but I think that there's only one constraint in $\lambda$? In total I see two constraints: $e^Tx -\kappa = 0$ and $(\mu-r)^Tx = 1$ but maybe that is wrong? I implemented that now at publiccode-zac-keskin.notebooks.azure.com/nb/notebooks/… and seem to get portfolio of weight -1 (for any value of N I try).. so seems like I'm close but maybe (hopefully) just a sign gone awry?? $\endgroup$
    – Zac
    Apr 6 '18 at 18:06
  • 1
    $\begingroup$ Sorry I think I get what you mean now, noting the Lagrangian of those four terms. It seems that stationarity requires $\frac{\partial L}{\partial \kappa} = \lambda_1 = 0$, interestingly. This is what I have implemented and I do now get a portfolio of weight 1. However, it appears to be finding the opposite to what we're after.. namely it looks like the portfolio which minimises the Sharpe ratio rather than the maximising portfolio. This should be clear from the plot at publiccode-zac-keskin.notebooks.azure.com/nb/notebooks/…, but I'm not sure why! $\endgroup$
    – Zac
    Apr 6 '18 at 22:57

H is the hessian matrix

f = [0;0;0;0;0;0;0;0;0;0;0];
n = 10;
rf = 0.0082;
ExpReturns =  -0.00591 + 0.002 * (1:10)';

% Optimization problem data
lb = zeros(n+1,1);
ub = inf*ones(n+1,1);
F = ones(n,1);
Aeq = [( AvrReturn- rf)' 0;ones(1,n) -1];
beq = [1; 0];
A = [eye(n),-1*ones(n,1)];
b = zeros(n,1);
[x4 fval4,exitflag,output] = quadprog(H,f,A,b,Aeq,beq,lb,ub)
y = x4(1:n);
k = x4(n + 1);
x = x4/k;
  • $\begingroup$ " ExpReturn" and "F " are not useful in the code, there should be ignored. $\endgroup$ Apr 14 '20 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.