296 Chapter 10
Excel itself is somewhat confused on this issue of dividing by M or by
M − 1. In the following spreadsheet we show several ways of computing
the means, variances, standard deviations, and covariances:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
ABCDEFG H
Date GE MSFT JNJ K B
AIBM
3-Jan-94 56.44% -1.50% 6.01% -9.79% 58.73% 21.51%
3-Jan-95 18.23% 33.21% 41.56% 7.46% -0.24% 6.04%
2-Jan-96 56.93% 44.28% 57.71% 37.76% 65.55% 27.33%
2-Jan-97 42.87% 79.12% 22.94% -5.09% 54.34% 41.08%
2-Jan-98 47.11% 38.04% 17.62% 32.04% 37.11% 2.63%
4-Jan-99 34.55% 85.25% 26.62% -10.74% 15.05% -2.11%
3-Jan-00 28.15% 11.20% 3.41% -48.93% 43.53% 23.76%
2-Jan-01 4.61% -47.19% 10.69% 11.67% 28.29% 21.76%
2-Jan-02 -19.74% 4.27% 23.11% 19.90% -15.09% 4.55%
2-Jan-03 -44.78% -29.47% -5.67% 10.88% -23.23% 15.54%
2-Jan-04 35.90% 18.01% -1.27% 15.49% 39.82% 31.80%
Mean GE MSFT JNJ K B
AIBM
23.66% 21.38% 18.43% 5.51% 27.63% 17.63% <-- =AVERAGE(G3:G13)
23.66% 21.38% 18.43% 5.51% 27.63% 17.63% <-- =SUM(G3:G13)/COUNT(G3:G13)
Variance GE MSFT JNJ K BA IBM
0.0941 0.1507 0.0327 0.0518 0.0814 0.0167 <-- =COVAR(G3:G13,G3:G13)
0.0941 0.1507 0.0327 0.0518 0.0814 0.0167 <-- =VARP(G3:G13)
0.1035 0.1657 0.0360 0.0570 0.0896 0.0184 <-- =VAR(G3:G13)
Standard
deviation
GE MSFT JNJ K BA IBM
0.3067 0.3882 0.1808 0.2275 0.2854 0.1293 <-- =SQRT(G20)
0.3067 0.3882 0.1808 0.2275 0.2854 0.1293 <-- =STDEVP(G3:G13)
0.3217 0.4071 0.1897 0.2386 0.2993 0.1356 <-- =STDEV(G3:G13)
Covariance(GE,MSFT)
0.0690 <-- =COVAR(B3:B13,C3:C13)
0.0690 <-- {=MMULT(TRANSPOSE(B3:B13-B16),C3:C13-C16)/11}
0.0758 <-- {=MMULT(TRANSPOSE(B3:B13-B16),C3:C13-C16)/10}
0.0758 <-- =COVAR(B3:B13,C3:C13)*11/10
SOME CONFUSION ABOUT M VERSUS M - 1 IN EXCEL?
Excel distinguishes between the population variance (Varp, which
divides by M) and the sample variance (Var, which divides by M − 1) and
distinguishes between the population and sample standard deviation
(Stdevp and Stdev, respectively). However, Excel does not make the
same distinction for its covariance function Covar. As you can see in cell
B30, Covar divides by M, in the same way that Varp divides by M. If you
want to create a corresponding covariance function that divides by M − 1,
you either have to multiply Covar by
M
M −1
as in cell B33 or you have to
use the array function =MMULT(TRANSPOSE(B3:B13-B16),C3:C13-
C16)/10 as in cell B32. If Excel were completely logical, it would have two