# Zero Beta Portfolio in R

I am trying to solve the zero portfolio problem in R. Given n assets, the objective function is to minimize the variance of the portfolio $$Min_x\;\; \frac{1}{2}x^T\Sigma x$$ subject to $$COV\left(x^T R, R^Tm \right) =0$$ and $$x^T \mathbb{1}=1$$ and $$\mu^Tx \geq \tau$$ Where $x$ are portfolio weights, $\tau$ is a required return and $R_m$ is a representative market index.

I have seen the relevant discussion here and the code provided but it does not fit the above specification. Is it possible to solve that problem either with solve.QP or any other function?

To be honest I'm a little confused by your notation so this is a preliminary answer which I'll either delete or amend depending on your responses.

If $x^TR$ is a deterministic scalar how are you defining the covariance?

What I think you might be defining is the discrete case of covariance:

$$Cov(x_iR_{m,i}, R_{m,j}) = \frac{1}{n} \sum_i (x_iR_{m,i} - E[x_iR_{m,i}]) (R_{m,i} - E[R_{m,i}]) = 0$$

In which case I'm assuming that $R_{m,i}$ are fixed, known values, in which case this constraint probably reduces to an affine one.

• In words. According to Morgan, I. G. (1975), the Zero Beta Portfolio is the minimum variance portfolio that is uncorrelated with a representative index $R_m$. The weights of the portfolio $x$ can be $>0$ or $<0$. There can be an other constrain that $B^Tx=0$ to ensure that portfolio is zero beta. Commented Aug 2, 2018 at 9:02
• There was an article by Gordon Alexander that presented an algorithm for finding the ZBP, sciencedirect.com/science/article/pii/0304405X77900125 I started writing some code for this years ago but TBH I never finished the project. (In any case I think you should check your equations against a published paper, the ones you have here may be mis-specified as has already been pointed out). Commented Aug 2, 2018 at 11:18
• The equations are from Morgan (1975) paper sciencedirect.com/science/article/pii/0304405X75900100 subject to a latter comment by Ross who stated that $Rm$ (the proxy) must be in the efficient frontier, which is not always the case, if one use a pre-calculated index such as S&P500. Commented Aug 2, 2018 at 12:17

The beta of your portfolio $\beta_P$ is given by $$\beta_P = \sum_{i=1}^n w_i \beta_i.$$ This can be seen from bilinearity of the covariance: $$Cov(\sum_{i=1}^n w_i r_i, r_M) = \sum_{i=1}^n w_i Cov(r_i, r_M).$$

Thus the constraint is linear and given above with the $\beta_i$ as constants and the weights are the variables that you want to optimize.

I assume that the solution will only be possible with a long/short portfolio. Thus, if your $\mu$ is a positive vector the condition on expected values that you have will render the problem infeasible.

• The ZBP is unique. It's return is an interesting number, worth determining, but it is whatever it is. To require that it exceeds the threshold $\tau$ is either unnecessary or will make the problem infeasible. Commented Aug 2, 2018 at 11:37