Tutorial 5: Analysis of Variance (ANOVA)

Exercise 1

We question if different stores at the mall have employees with the same avergae age.

Samples of employees were randomly selected from three different types of stores, and their ages recorded.

  1. What statistical procedure can we use?

  2. What are the assumptions to use the parametric test in this context.

We assume that these assumptions are met.

  1. At the 0.05 significance level, test the claim that there is a difference in mean ages for the three groups.

We give the following information about the sampling:

  • Department Store: \(\bar{x} = 47.2\) and \(n=6\)
  • Music: \(\bar{x} = 26.8\) and \(n=6\)
  • Sporting Goods \(\bar{x} = 29.8\) and \(n=6\)

We also have \(\text{SSB} = 1446\) and \(\text{SSW} = 1377\).

Solution

  1. We will use an ANOVA.

  2. We can test that the age mean are the same in the different stores with a Fisher test. For this test, the assumptions are that: observations are independent, approximately Gaussian with constant variance.

  3. The Fisher statistic in this context is: \[F = \frac{\text{SSB}/(I - 1)}{\text{SSW}/(N - I)}\] where \(I\) is the number of groups, and \(N\) the total number of observations.

Here, \(I = 3\), \(N = 18\), we can compute \(f = \frac{1446/2}{1377/15}\):

1446/2 * 15/1377
[1] 7.875817

and the associated p-value:

1 - pf(1446/2 * 15/1377, df1 = 2, df2 = 15)
[1] 0.004588524

So we reject the null hypothesis that mean age are the same in the different stores, there is a statistically significant difference in mean age between store (at level \(\alpha = 5\%\)).


source

Exercise 2

The number of grams of fat per serving for three different varieties of pizza from several manufacturers is measured and a partial ANOVA table is provided below.

  1. Complete the ANOVA table.

  2. At the 0.05 significance level, is there a significant difference in mean fat content for the three varieties?

\[ \begin{array}{ccccc} & \text{SS} & \text{df} & \text{MS} & \text{F} \\ \text{Between} & 23 & 2 \\ \text{Within} & 316.9 & 18 \\ \text{Total} & 339.9 & 20 \end{array} \]

We also give the following results regarding the model residuals:

Solution

  1. Here is the completed ANOVA table:

\[ \begin{array}{ccccc} & \text{SS} & \text{df} & \text{MS} & \text{F} \\ \text{Between} & 23 & 2 & 11.5 & \sim 0.653 \\ \text{Within} & 316.9 & 18 & \sim 17.6 \\ \text{Total} & 339.9 & 20 \end{array} \] Note: the Fisher statistic value is \(f = \frac{23/2}{316.9/18}\).

  1. Following the representation of the residuals, we see that the variance is not constant (it depends on the “pizza” class), hence the homoscedasticity assumptions is not met and we cannot use the Fisher test.
performance::check_heteroscedasticity(mod)
Warning: Heteroscedasticity (non-constant error variance) detected (p = 0.004).

source