# Marginal Risk Contribution under Factor structure

Given the factor structure below with K factors, the return for N assets is given by (under matrix notation):

$$R =\alpha + \beta F + \epsilon$$

where $$F$$ is matrix of K factor returns and $$\beta$$ is matrix of NxK factor loadings and $$\epsilon \sim N(0,\Omega)$$. The return on a portfolio of those N stocks with weight vector $$w$$ can be written as:

$$Ptf = wR = w\alpha + wBF + w\epsilon$$

Taking the expectation and variance yields:

$$E[Ptf] = w\alpha + w \beta E[F]$$

$$V[Ptf] = (w\beta)\Sigma (w \beta)^T + w\Omega w^T$$

Where $$\Sigma$$ is the covariance matrix of the factors and $$\Omega$$ is the diagonal covariance matrix of specific risk component.

It follows that the standard deviation of the portfolio is: $$\sigma_{ptf}=\sqrt{V[Ptf]}$$

I am interested in the marginal risk contribution $$MRC$$ of the stocks, but also the factors to the portfolio. My derivation of $$MRC$$ which I obtained by generalizing the common case of no factor structure is as follows:

$$MRC = \partial \sigma_{ptf} /\partial w = (w\beta\Sigma \beta^T + w\Omega)/\sigma_{ptf}$$

My problem arises when I compute $$MRC$$ using the the equation above. In fact when I re-compose the risk using the weights, I do not find it is equal to the portfolio risk. Any help is appreciated. I will upload sample code shortly.

Let $$\mathbf{w}$$ denote the $$N\times 1$$ vector of portfolio weights, $$B$$ the $$N\times K$$ factor loading matrix, $$\Sigma$$ the $$K\times K$$ matrix of factor covariances and $$\Omega$$ the $$N\times N$$ diagonal matrix of idiosyncratic risks.

Then the $$N\times N$$ matrix of asset variances is

$$\Sigma_N=B\Sigma B^T+\Omega$$ and the portfolio variance is $$\sigma_p^2=\mathbf{w}^T\Sigma_N\mathbf{w}=\mathbf{w}^TB\Sigma B^T\mathbf{w}+\mathbf{w}^T\Omega \mathbf{w}$$

The MRC vector, defined as $$\mathbf{v}=\partial \sigma_p/\partial \mathbf{w}$$ is:

$$\mathbf{v}\equiv\frac{\partial \sigma_p}{\partial \mathbf{w}}=\frac{B\Sigma B^T\mathbf{w}+\Omega \mathbf{w}}{\sigma_p}$$

Clearly, if you now compute $$\mathbf{w}^T\mathbf{v}$$, you obtain $$\sigma_p$$, the portfolio risk.

• Thanks @Kermittfrog, I had $\Omega$ as a vector in my python implementation and the addition was still going through with no error even though dimensions were mismatched. Just wanted to make sure the math was right. Jun 28 at 16:16