*“It has been a cruel summer for one of the trendiest, most innovative investment strategies of the asset management industry”.*

This quote was taken from an article last week in the FT.

• Title: Risk parity funds suffer a cruel summer

• Author: Robin Wigglesworth

• Source: Financial Times (FT)

http://www.ft.com/cms/s/0/d210373e-5142-11e5-8642-453585f2cfcd.html?siteedition=intl#axzz3kbVfJfnX

Here I will demonstrate how a **risk parity portfolio** can be calculated quite easily using **R**.

By definition, a risk parity portfolio is one for which all **percentage contributions to risk (PCTR) are equal**. By the same definition, it means that the total contributions to risk (TCTR) are all equal also.

Using some basic calculus, it can be shown that the volatility of a portfolio can be decomposed as the weighted sum of each asset’s **marginal contribution to risk (MCTR).** MCTR tells us the impact of an infinitesimal increase in an asset’s weight on the total portfolio risk. With each MCTR known, each assets PCTR can be derived.

In general, a risk-parity portfolio needs to be solved by some *numerical method*, for example a **Newton algorithm**.

The setup for the Newton method requires writing the risk parity problem as a system of nonlinear equations (imposing the restriction that the weights add up to one), finding the *Jacobian* (using multivariable calculus) and taking a *one-term Taylor expansion approximation*. Then the Newton iteration can be formulated by defining a *stopping rule* and *starting point*.

For reference, see “Efficient Algorithms for Computing Risk Parity Portfolio Weights”

So using simple arithmetic and matrix operations, I demonstrate how this can be implemented. My example portfolio consists of 9 liquid stocks using end-of-day (EOD) prices sourced from **Quandl**.

As we can see in the attachment, each asset’s PCTR is 11.11%

Now, is that trendy and innovative or what?

*Thanks to Doug Martin for his lectures on portfolio optimization.*