Covariance is a measure of how two variables move together. A positive covariance indicates that the variables tend to move together in the same direction. Whereas, a negative covariance indicates that the variables tend to move in opposite directions.
If two variables X and Y have expected values of E(X) and E(Y), then the covariance can be calculated as:
Cov (X,Y) = E[X – E(X)] [Y – E(Y)]
Calculate the covariance of two stocks A and B given two possible states of the economy. Refer to the table below.
|Scenario||P(Scenario)||Expected Returns of A||Expected Returns of B|
The expected return of A is: 0.2 x 1 + 0.8 x 8 = 6.6%
The expected return of B is: 0.2 x 3 + 0.8 x 6 = 5.4%
The covariance can be calculated as:
0.2 (1 – 6.6) (3 – 5.4) + 0.8 (8 – 6.6) (6 – 5.4) = 2.688 + 0.672 = 3.36
Correlation is a standardized measure of the linear relationship between two variables. It is obtained by dividing the covariance of two variables by the product of their standard deviations. The correlation coefficient can range from -1 to +1.
Corr (X,Y) = Cov (X,Y) / σ (X) σ (Y)
From the previous example, the covariance between Stock A and Stock B is 3.36. Calculate the correlation given that the standard deviation of Stock A is 2.8 and the standard deviation of Stock B is 1.2
Corr (A,B) = 3.36/(2.8)(1.2) = 1