Skip to content
All library documents

Minimum-Variance Portfolio Weights with a Beta-Neutral Constraint

Article Quant Q&A · Author: jeheran sankti

Summary

The document formulates a mean-variance optimization problem for a portfolio constrained to have zero market beta. It assumes estimates of asset expected returns, a covariance matrix, and betas, then minimizes portfolio variance while requiring a target expected return, weights summing to one, and beta neutrality. Lagrange multipliers yield a system of linear equations from which the weights can be calculated.

The method can produce a portfolio with a minimum estimated variance for each chosen return target; repeating the calculation across targets traces an efficient frontier. The answer notes that its interpretation of “optimal” is an assumption and that the resulting solution is not restricted to preserving a specified count of long and short positions. The formulation depends on reliable inputs and does not address practical constraints such as position bounds, transaction costs, turnover, or estimation error. The displayed derivation also contains apparent inconsistencies in its final equations, so those should be checked before implementation.

Key ideas

  • The proposed objective is to minimize portfolio variance for a specified expected return.
  • The constraints require fully allocated weights and zero portfolio beta.
  • A Lagrangian converts the constrained optimization into a linear system for the multipliers and asset weights.
  • Solving across multiple return targets gives points on an estimated efficient frontier.
  • The formulation does not preserve a required number of long and short positions or include trading frictions.

Tags

Full text
# How to get the weights for a beta neutral portfolio?


# How to get the weights for a beta neutral portfolio?












Given a ranking of 100 long stocks and 100 short stocks. Looking at these 200 betas: How can I find the optimal weights to get a beta = 0 long/short portfolio?

## Answer by emot (score 3)

https://quant.stackexchange.com/a/66236

The author did not define what optimal means, therefore I assume here that we want to find portfolio that has $\beta=0$ and has minimum variance $\sigma^2_{\pi}$ for the expected return $\mu_{\pi}$. This is an extension to Markowitz portfolio and we can find efficient frontier i.e. the set of portfolios that has the lowest risk for a given level of expected return. The algorithm below is not constrained to finding 100 long stocks and 100 shorts stocks, rather it finds optimal weights that minimize the variance no matter how many long and shorts positions it produces. By reading comments I assume that this would be sufficient.

We are in an economy with $n$ different assets. Each asset $i$ is characterized by its expected return $\mu_i$ and variance $\sigma^2_i$. Assets $i$ and $j$ are correlated with correlation $\rho_{i,j}$. The proportion invested in asset $i$ is $w_i$.

Asset's $i$ return is given by: $$\mu_i=\alpha_i+\beta_i r_m+\epsilon_i$$ where $\alpha$ is asset's alpha and $\beta$ is assets beta and $r_m$ is market return.

The vector of asset expected return

$$\mu=[\mu_1,...,\mu_n]'$$

The weight vector

$$w=[w_1,...,w_n]'$$

The Betas vector: $$\beta=[\beta_1,...,\beta_n]'$$

Covariance matrix $\Sigma$ is given as: $$ \begin{bmatrix} \sigma_1^2 & \rho_{1,2}\sigma_1 \sigma_2 & \cdots & \rho_{1,n}\sigma_1 \sigma_n\\ \vdots & \vdots & \ddots & \cdots \\ \rho_{1,n}\sigma_1 \sigma_n & \cdots & \cdots & \sigma_n^2\\ \end{bmatrix} $$

Therefore the portfolio return is given by: $$\mu_{\pi}=\mu'w$$ Portfolio variance: $$\sigma^2_{\pi}=w'\Sigma w$$

The portfolio selection problem is defined as a minimization of risk subject to a return constraint. Our objective function is the portfolio variance and we will minimize it with respect to the portfolio weights. Therefore we want to minimize: $$min_w \frac{1}{2} \sigma^2_{\pi}=\frac{1}{2} w'\Sigma w$$ with 3 constraints: $$\mu'w=m$$ i.e. the portfolio return must be equal to a prespecified level $m$. $$\mathbf 1'w=1$$ i.e. the portfolio weights have to sum to 1. $$\beta' w=0$$ i.e. the portfolio beta has to be 0.

This problem is an optimization with equality constraints. We can solve it using the method of Lagrange. We form the Lagrange function with three Lagrange multipliers $\lambda$, $\gamma$, $\theta$: $$L(w,\lambda, \gamma, \theta)=\frac{1}{2} w'\Sigma w + \lambda (m-w'\mu) + \gamma (1-w'\mathbf 1) + \theta (-w'\beta)$$

Next, we solve for the first order condition by taking the derivative with respect to the vector w: $$\frac{\partial L}{\partial w} = \Sigma w - \lambda \mu - \gamma \mathbf 1 - \theta \beta = 0$$ Checking the second order condition, the Hessian of the objective function is equal to the covariance matrix $\Sigma$, which is positive definite. Therefore, we have reached the optimal weight vector $w^*$: $$w^*=\Sigma^{-1} (\lambda \mu + \gamma \mathbf 1 + \theta \beta)$$

To solve for $\lambda$, $\gamma$, $\theta$ we have to substitute $w^*$ to three constraints equations:

$$\mu' \Sigma^{-1} (\lambda \mu + \gamma \mathbf 1 + \theta \beta)=m$$ $$1' \Sigma^{-1} (\lambda \mu + \gamma \mathbf 1 + \theta \beta)=1$$ $$\beta' \Sigma^{-1} (\lambda \mu + \gamma \mathbf 1 + \theta \beta)=0$$

This yields: $$\lambda \mu' \Sigma^{-1} \mu + \gamma \mu' \Sigma^{-1} \mathbf 1 + \theta \mu' \Sigma^{-1} \beta=m$$ $$\lambda \mathbf 1' \Sigma^{-1} \mu + \gamma \mathbf 1' \Sigma^{-1} \mathbf 1 + \theta \mathbf 1' \Sigma^{-1} \beta=1$$ $$\lambda \beta' \Sigma^{-1} \mu + \gamma \beta' \Sigma^{-1} \mathbf 1 + \theta \beta' \Sigma^{-1} \beta=0$$

For our convenience let's define the following scalars: $$A=1' \Sigma^{-1} 1$$ $$B=\mu' \Sigma^{-1} 1=1'\Sigma^{-1} \mu$$ $$C=\mu' \Sigma^{-1} \mu$$ $$D=\beta' \Sigma^{-1} 1 = 1' \Sigma^{-1} \beta$$ $$E=\beta' \Sigma^{-1} \beta$$ $$F=\beta' \Sigma^{-1} \mu = \mu' \Sigma^{-1} \beta$$

Therefore rewriting our system of equations in terms of A, B, C... we get: $$\lambda C + \gamma B + \theta F = m$$ $$\lambda B + \gamma A + \theta D = 1$$ $$\lambda F + \gamma D + \theta E = 1$$

Putting it in the matrix form we get:

$$ \begin{bmatrix} C & B & F\\ B & A & D \\ F & D & E\\ \end{bmatrix} * \begin{bmatrix} \lambda \\ \gamma \\ \theta \\ \end{bmatrix} = \begin{bmatrix} m \\ 1 \\ 0 \\ \end{bmatrix} $$

Therefore the solution is: $$ \begin{bmatrix} \lambda \\ \gamma \\ \theta \\ \end{bmatrix} = \begin{bmatrix} C & C & F\\ B & A & D \\ F & D & E\\ \end{bmatrix}^{-1} * \begin{bmatrix} m \\ 1 \\ 0 \\ \end{bmatrix} $$

Putting $\lambda$, $\gamma$, $\theta$ into our equation of vector $w^*$ we get the weights: $$w^*=\Sigma^{-1} (\lambda \mu + \gamma \mathbf 1 + \theta \beta)$$

How to produce efficient frontier curve? Calculate portfolio expected returns and standard deviation for different levels $m$ and plot the result. I have implemented it to check if that works and I got standard efficient frontier curve:

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.