What is 'Covariance'
Covariance is a measure of the degree to which returns on two risky assets move in tandem. A positive covariance means that asset returns move together, while a negative covariance means returns move inversely. Covariance is calculated by analyzing at return surprises (standard deviations from expected return), or by multiplying the correlation between the two variables by the standard deviation of each variable.
BREAKING DOWN 'Covariance'Possessing financial assets that provide returns that have a high covariance with each other does not provide very much diversification. For example, if stock A's return is high whenever stock B's return is high and the same can be said for low returns, then these stocks are said to have a positive covariance. Diversifying earnings or other company metrics can be done by investing in financial assets that have low covariance to each other.
Example Covariance Calculation
When an analyst has a set of data, a number of pairs of x and y values, covariance can be calculated using five variable from that data. They are:
x(i) = a given x value in the data set
x(m) = the mean, or average, of the x values
y(i) = the y value in the data set that corresponds with x(i)
y(m) = the mean, or average, of the y values
n = the number of data points
Given this information, the formula for covariance is:
Cov(x,y) = SUM OF ((x(i) - x(m) * (y(i) - y(m)) / (n - 1)
For example, assume an analyst in a company has a five-quarter data set that shows quarter's gross domestic product (GDP) growth in percentages (x) and a company's new product line growth in percentages (y). The data set may look like:
Q1: x = 2, y = 10
Q2: x = 3, y = 14
Q3: x = 2.7, y = 12
Q4: x = 3.2, y = 15
Q5: x = 4.1, y = 20
The average x value equals 3, and the average y value equals 14.2. To calculate the covariance, the sum of the products of the x(i) values minus the average x value, multiplied by the y(i) values minus the average y values would be divided by (n-1), as follows:
Cov(x,y) = ((2 - 3) x (10 - 14.2) + (3 - 3) x (14 - 14.2) + ... (4.1 - 3) x (20 - 14.2)) / 4 = (4.2 + 0 + 0.66 + 0.16 + 6.38) / 4 = 2.85