We looked at the most basic way to calculate value at risk for a single asset holding. In most cases, there will be more than a single asset in the portfolio. Value at risk can be calculated on each asset and then summed. It is a reasonable number as value at risk, albeit an undiversified value at risk. Statistically speaking, movement of market prices are correlated with each other either positive (moving in the same direction) or negative (moving in the opposite direction).

In this article we will illustrate how to take into account the correlation for your calculation of value at risk for two assets.

Lets consider holding of two stocks, Apple and Ford Motors. The log returns are calculated in the same manner we did in Part 1 and so are the volatilities.

If we switch between the two stocks, we will notice that at times, the stock are moving in the same direction, while at other times, they are moving in the opposite directions, albeit by different quantum. We will need to find out the correlation between the two stocks. For now, lets calculate the undiversified value at risk i.e. the sum of value at risk of each stock with 95% confidence interval.

Lets assume that we have to invest our money equally into these two stocks. So for every stock invested in Apple an amount of roughly 264 \(\left(\frac{351.59}{1.33} \right)\) Ford's stock must be held. Our assumption is mainly made to effectively illustrate the difference between the result.

\( \begin{align} \text{VaR}_{apple} &= 1.645\sigma P \\ &=1.645 \times 0.025393 \times 351.59 \\ &=14.69 \end{align} \)

\( \begin{align} \text{VaR}_{ford} &= 264 \times 1.645\sigma P \\ &=264 \times 1.645 \times 0.038039 \times 1.33 \\ &=21.97 \end{align} \)

The undiversified value at risk is 36.66. Lets take the correlation into account. Correlation can be calculated using CORREL function available in most spreadsheets. Since we are using python for our calculation engine numpy package provide *corrcoef* function to calculate the correlation coefficient (see *corrcoef* documentation here ).

For a portfolio of two assets, the value at risk is calculated as below:

\( \begin{align} \text{VaR}_{portfolio} &= \sqrt{\text{VaR}_{apple}^2 + \text{VaR}_{ford}^2 + 2 \times \text{correlation} \times \text{VaR}_{apple} \times \text{VaR}_{ford}} \\ &= \sqrt{14.69^2 + 21.97^2 + 2 \times 0.1312 \times 14.69 \times 21.97 }\\ &=27.99 \end{align} \)

\(\text{VaR}_{portfolio}\) is a much lower number than the undiversified value at risk. A simplified formula of the above for larger number of assets:

\( \begin{align} \text{VaR}_{portfolio} &= \sqrt{WRW^T} \\ \text{where } W &= \left[\begin{matrix} w_1 & ... & w_n \end{matrix}\right]\\ w_n &= \text{asset}_n \text{ value }\times z \times \sigma_{asset_n}\\ z&= \text{z score for the confidence interval}\\ R&= \text{correlation matrix } \\ &=\left[\begin{matrix} \rho_{1,1} & ... & \rho_{1,n} \\ \vdots & ... & \vdots \\ \rho_{m,1} & ... & \rho_{m,n} \end{matrix} \right]\\ \rho_{m,n} &= \text{ correlation between asset } m \text{ and asset }n \text{, and } m = n\\ W^T &= \text{transpose of matrix } W \end{align} \)

We have added slight complexity to calculating value at risk from a single asset to two assets. In doing so, we calculated correlation and introduced a simplified formula with matrices. In the next coming article, we will further add another problem to the calculation - investment in another currency.