Much like this post: https://stats.stackexchange.com/questions/119795/quadratic-programming-and-lasso, I'm trying to integrate RIDGE Penalty in a dedicated quadratic solver. In my case, I am working with quadprog from MATLAB. Unlike LASSO where you can eliminate the absolute value in the constrained form and rewrite them in linear form (effectively keeping a quadratic problem), you can't with RIDGE. This means that in order to have a quadratic problem, I have to work with the penalty form:

$$ RIDGE: \sum_{i=1}^{N} (y - x'\beta)^2 + \lambda \sum \beta_{i}^{2}$$

My explicit problem is to minimize the variance with added RIDGE Penalty.

$${\underset{w}{\arg\min}} \frac{1}{2} w' \Sigma w \ + \lambda \sum w_i^{2}$$ $$s.t. \ \sum_{i=1}^{N} w_i = 1$$

Basically, I want to minimize the variance while summing the weights to 1. A pretty standard problem in finance. My question is: How to adapt the objective function so that it includes the penalty? When working with a dedicated solver like quadprog, you can only specify the positive definite squared matrix and the vector for the unsquared terms. With the formulation below, you then specify $H$ and $f$. Link: https://www.mathworks.com/help/optim/ug/quadprog.html

$${\underset{x}{\arg\min}} \frac{1}{2} x' H x \ + f'x$$

I can either modify H (which is my covariance matrix), but this would change the number of values in my $w$ vector, or I could work with $f'$, but this is for unsquared term. I need to implement $\lambda x'x$ in my objective function, which is equal to $\lambda \sum x_i^{2}$.


1 Answer 1


The model you were assigned comes from the following paper:

  • de Miguel et al (2009) A Generalized Approach to Portfolio Optimization: Improving Performance by Constraining Portfolio Norms

Instead of using an additive penalty term, the ridge shrinkage of the portfolio weight vector should, or works best, as a separate constraint:

$${\underset{w}{\arg\min}} \frac{1}{2} w' \Sigma w \ $$

\begin{aligned} s.t. & \sum w_i^{2} \leq \delta^2 \\ & \ \sum_{i=1}^{N} w_i = 1 \end{aligned}

where $\delta$ has a one-to-one inverse correspondence to $\lambda$. In other words, instead of increasing $\lambda$ to make the portfolio weights smaller, you decrease $\delta$ to achieve the same regularization effect.

This is what is meant by adapting the objective function for the penalty. The linear regression formula first shown is better suited to the Lagrangean approach to regularization, whereas the optimization (second) formula you showed is better suited to the constrained optimization approach of regularization, and also deflects concerns of non-linear optimization since the main objective function (portfolio variance) I wrote is quadratic as is, while the two constraints are linear. Both approaches are equivalent due to the one-to-one correspondence between $\lambda$ and $\delta$.

If you insist on using the additive $\lambda$ penalty term, then the objective would reduce to the well-known closed-form analytical solution for the ridge covariance matrix where $I$ is an identity matrix the size of $\Sigma$.

$${\underset{w}{\arg\min}} \frac{1}{2} w'(\Sigma + 2\lambda I)w$$ $$s.t. \ \sum_{i=1}^{N} w_i = 1$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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