Chapter 10 Analysis of Variance 401
Note that we take each squared difference and multiply it by the number
of observations in the group. In this hotel data set, each group has eight
observations, so the value of ni is always eight. The between-groups sum of
squares for the hotel data is equal to 472,716.4 (cell B13).
But note that the total sum of squares is equal to the within-groups sum
of squares plus the between-groups sum of squares, because 933,747.9 5
461 ,031.5 1472 ,716.4. In general terms,
Total SS 5 SSE 1 SST
Let’s try to relate this to the price of staying at hotels in various cities. If
the average prices in the various cities are very different, the between-groups
sum of squares will be a large value. However, if the city averages are close
in value, the between-groups sum of squares will be near zero. The argu-
ment goes the other way, too; a large value for the between-groups sum of
squares could indicate that the city averages are very different, whereas a
small value might show that they are not so different.
A large value for the between-groups sum of squares could also be due to a
large number of groups, so you have to adjust for the number of groups in the
data set. The degrees of freedom (df) column in the ANOVA table (cells C13:
C16) tells you that. The df for the city factor (in this case the between-groups
term) is the number of groups minus 1, or 4 2153 (cell C13). The degrees of
freedom for the total sum of squares is the total number of observations minus 1,
or 322153 1 (cell C16). The remaining degrees of freedom are assigned to the
error term (the within-groups term) and are equal to 3123528 (cell C14).
The Mean Square (MS) column (cells D13:D14) shows the sum of squares
divided by the degrees of freedom; you can think of the entries in this col-
umn as variances. The fi rst value, 157,572.3 (cell D13), measures the vari-
ance in hotel cost between the various cities; the second value, 16,465.1 (cell
D14), measures the variance of the cost within cities. The within-groups mean
square also estimates the value of s^2 —the variance of the error term e shown
in the means model earlier in the chapter. If the variability in hotel prices be-
tween cities is large relative to the variability of hotel prices within the cities,
then we might conclude that mean hotel price is not the same for each city.
To test this, we calculate the ratio of the two variances. Under the null
hypothesis, this value should follow an F distribution with n, m degrees of
freedom, where n is the degrees of freedom for the between-groups variance
and m is the degrees of freedom for the within-groups variance.
In the hotel data, the F value is 9.570 (cell E13) and follows an F(3,28)
distribution. Excel calculates the p value to be .000163 (cell F13), which is
less than .05. We reject the null hypothesis, accepting the alternative that
there is a difference in the mean hotel price.
Although the output does not show it, you can use the values in the ANOVA
table to derive some of the same statistics you used in regression analysis. For
example, the ratio of the between-groups sum of squares to the total sum of
squares equals R^2 , the coeffi cient of determination discussed in some depth
in Chapters 8 and 9. In this case R^25 472,716.4/933,747.9 5 0.50626. Thus
about 50% of the variability in hotel price is explained by the city of origin.