Skip to content
All library documents

Maximum Diversification Portfolios and Nonlinear Optimization in R

Article Quant Q&A · Author: user1234440

Summary

The document introduces the maximum diversification portfolio objective, defined as the weighted sum of asset volatilities divided by portfolio volatility. The numerator uses asset weights and individual volatilities; the denominator depends on the covariance matrix and the portfolio weights. It points readers to an implementation of this approach in R and to research describing the method.

The discussion cautions that the objective does not fit the quadratic optimization form handled by R’s quadprog package, so that solver is not a direct match. It suggests using a general-purpose nonlinear optimizer instead. The answers do not provide a complete implementation, specify portfolio constraints, or compare optimization methods, so practical use still requires selecting constraints and reviewing the referenced methodology and code.

Key ideas

  • The diversification ratio compares weighted asset volatilities with the volatility of the combined portfolio.
  • Portfolio weights and the covariance matrix determine the denominator of the objective.
  • The stated objective is not in the standard quadratic form expected by quadprog.
  • A general-purpose nonlinear optimizer can be considered for this formulation.

Tags

Full text
# How to implement Maximum Diversification in R?


# How to implement Maximum Diversification in R?












I am trying to code up the optimization problem for Max Diversification Portfolios.

The main problem I am having is properly translating the objective function in to code and port it in to the optimizer in general.

How would one approach this? Can this be solved with R's `quadprog`?

The objective function to maximize is the diversification ratio:

```
d(P) = P'E / sqrt(P'VP)
```

Where:

- `E` is vector of asset volatilities,

- `P` is the vector of weights

- `V` is the covariance matrix.

## Answer by vonjd (score 5, accepted)

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

You can find the full R source code for that at the site of Systematic Investor.

For example have a look at this post about Maximum Sharpe Portfolios. There you see that he created the helper function `portfolio.allocation.helper` for the following optimization methods:

```
EW=equal.weight.portfolio,
RP=risk.parity.portfolio,
MV=min.var.portfolio,
MD=max.div.portfolio,
MC=min.corr.portfolio,
MC2=min.corr2.portfolio,
MCE=min.corr.excel.portfolio,
MS=max.sharpe.portfolio
```

Now the full source code can be found here.

You'll want to have a look at `max.div.portfolio` which is based on the method in:

> Toward Maximum Diversification by Y. Choueifaty, Y. Coignard, The Journal of Portfolio Management, Fall 2008, Vol. 35, No. 1: pp. 40-51

## Answer by SRKX (score 4)

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

For the record, the formula for maximum diversification portfolio can be found in this paper.

As you can see from the `quadprog` documentation, it minimizes problems of the following form:

$$ \min - d'b + \tfrac12 b' D b ~ \text{with} ~ A' b \geq b_0 $$

So clearly, it's not good for your formula.

You can consider optim or one of its extensions for your problem.

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.