Covariance, correlation and beta – some examples
Calculating Covariance
The calculation for covariance of a security starts with finding a list of previous prices. This is labeled as “historical prices” on most quote pages. Typically, the closing price for each day is used to find the return from one day to the next. Do this for both stocks, and build a list to begin the calculations.
Day |
ABC RETURNS (%) |
XYZ RETURNS (%) |
1 |
1.1 |
3 |
2 |
1.7 |
4.2 |
3 |
2.1 |
4. |
4 |
1.4 |
4.1 |
5 |
0.2 |
2.5 |
From here, we need to calculate the average return for each security:
For ABC it would be (1.1 + 1.7 + 2.1 + 1.4 + 0.2) / 5 = 1.30
For XYZ it would be (3 + 4.2 + 4.9 + 4.1 + 2.5) / 5 = 3.74
Now, it is a matter of taking the differences between ABC’s return and ABC’s average return, and multiplying it by the difference between XYZ’s return and XYZ’s average return.
The last step is to divide the result by the sample size and subtract one. If it was the entire population, then you could just divide by the population size.
Represented by this equation:
Covariance= ∑ (Return ABC – Average return ABC) x (Return XYZ – Average return XYZ) / (Sample Size) – 1
For example:
= [(1.1 – 1.30) x (3 – 3.74)] + [(1.7 – 1.30) x (4.2 – 3.74)] + … and so on results in:
[0.148] + [0.184] + [0.928] + [0.036] + [1.364] = 2.66 / (5 – 1) = 0.665
In this situation, we are using a sample, so we divide by the sample size (five) minus one.
You can see that the covariance between the two stock returns is 0.665, which means that they move in the same direction. When ABC had a high return, XYZ also had a high return. You will also note that these are the same return sets used to calculate standard deviation.
Calculating Correlation factors
The most familiar measure of dependence between two quantities is the Pearson product moment correlation co-efficient, or “Pearson’s correlation.”
It is obtained by dividing the covariance of the two variables by the product of their standard deviations. Karl Pearson developed the coefficient from a similar but slightly different idea.
The population correlation coefficient ρX,Y between two random variables X and Y with expected values μX and μY and standard deviations σX and σY is defined as:
Formula:
ρX,Y = Cov XY / σX σY
Likewise, if you have been given the correlation figure and standard deviation figures, you can work out covariance:
CovXY = ρX,Y, σX, σY
Calculating Beta factors
The formula for the beta can be written as:
Beta = Covariance stock versus market returns / Variance of the Stock Market
See above for calculation of covariance.
You may also see Beta expressed as the following formula:
(σS / σM) ρ
where:
σS is the volatility of the security / portfolio,
σM is the volatility of the market
ρ is the correlation coefficient between the security / portfolio and the market.
Example
Portfolio FGH has a standard deviation of 6%
The benchmark market has a standard deviation of 4%
The correlation coefficient between FGH and the market is 0.8
Using the first formula:
Covariance of stock versus market returns is 0.8 x 6 x 4 = 19.2
19.2 / 4^2 (variance of market) = 19.2 / 16 = 1.2
Using the second formula:
The beta of portfolio FGH is 6/4 x 0.8 = 1.2