# Covariance Calculation

In the example below the the covariance is stated as 774.48. The formula is Σ(xi-xavg)(yi-yavg)/(n-1}.

        Sci A (X)   AT&T(Y)
%           %
1989    80.95%      58.26
1990    -47.37%     -33.79
1991    31.00%      29.88
1992    132.44%     30.35
1993    32.02%      2.94
1994    25.37%      -4.29
1995    -28.57%     28.86
1996    0.00%       -6.36
1997    11.67%      48.64
1998    36.19%      23.55
avg     27.37%      17.80
s.d.    51.36       27.89
covariance: 774.48


What I got using the formula above is: 0.069703331. Can anyone see where I am very obviously going wrong?

## 3 Answers

It appears that the stated covariance assumes that the percentage signs have been removed. If you are using Excel or some similar software, create new columns without the percentage signs like so:

        [,1]   [,2]
80.95  58.26
-47.37 -33.79
31.00  29.88
132.44  30.35
32.02   2.94
25.37  -4.29
-28.57  28.86
0.00  -6.36
11.67  48.64
36.19  23.55


Notice that your answer (after your update) is off by the correct answer by a factor of 10,000; i.e. 100 ^ 2. When you change the scale from percent to percentage points (by multiplying your columns by 100), you will get the answer you're looking for.

You are dividing your series by 100, while the problem intends you to take the values as is. Use the given level values (i.e. 80.95, not 0.8095), and you'll get the covariance of 774.48.

Played around more and I now have an answer. Firstly I had mistakenly added in an additional line when summing the product column (Σ); secondly the answer I get is 0.07744814556. Why it is stated in the exercise book as 774.48 I am still not clear, but it at least shows me the formula is correct.