maths.freeStatistics & Probability › ANOVA and the F distribution

ANOVA and the F distribution

Comparing several means at once by comparing variances.

Analysis of variance tests whether three or more group means are equal by comparing the variation between groups with the variation within them. Their ratio follows an F distribution; a big F says the groups differ more than chance would allow.

One-Way ANOVA

The purpose of a one-way ANOVA test is to determine the existence of a statistically significant difference among several group means. The test uses variances to help determine if the means are equal or not. To perform a one-way ANOVA test, there are five basic assumptions to be fulfilled:

  • Each population from which a sample is taken is assumed to be normal.
  • All samples are randomly selected and independent.
  • The populations are assumed to have equal standard deviations (or variances).
  • The factor is a categorical variable.
  • The response is a numerical variable.

The Null and Alternative Hypotheses

The null hypothesis is that all the group population means are the same. The alternative hypothesis is that at least one pair of means is different. For example, if there are k groups

H0: μ1 = μ2 = μ3 = ... = μk

Ha: At least two of the group means μ1, μ2, μ3, ..., μk are not equal. That is, μiμj for some ij.

The graphs, a set of box plots representing the distribution of values with the group means indicated by a horizontal line through the box, help in the understanding of the hypothesis test. In the first graph (red box plots), H0: μ1 = μ2 = μ3 and the three populations have the same distribution if the null hypothesis is true. The variance of the combined data is approximately the same as the variance of each of the populations.

If the null hypothesis is false, then the variance of the combined data is larger, which is caused by the different means as shown in the second graph (green box plots).

One-Way ANOVA

Use the following information to answer the next five exercises. There are five basic assumptions that must be fulfilled to perform a one-way ANOVA test. What are they?

The F Distribution and the F Ratio

The distribution used for the hypothesis test is a new one. It is called the F distribution, named after Sir Ronald Fisher, an English statistician. The F statistic is a ratio (a fraction). There are two sets of degrees of freedom: one for the numerator and one for the denominator.

For example, if F follows an F distribution and the number of degrees of freedom for the numerator is 4, and the number of degrees of freedom for the denominator is 10, then F ~ F4,10.

To calculate the F ratio, two estimates of the variance are made.

  1. Variance between samples: an estimate of σ2 that is the variance of the sample means multiplied by n, when the sample sizes are the same. If the samples are different sizes, the variance between samples is weighted to account for the different sample sizes. The variance is also called variation due to treatment or explained variation.
  2. Variance within samples: an estimate of σ2 that is the average of the sample variances, also known as a pooled variance. When the sample sizes are different, the variance within samples is weighted. The variance is also called the variation due to error or unexplained variation.
  • SSbetween = the sum of squares that represents the variation among the different samples
  • SSwithin = the sum of squares that represents the variation within samples that is due to chance

To find a sum of squares mean, add together squared quantities which, in some cases, may be weighted. We used sum of squares to calculate the sample variance and the sample standard deviation in Descriptive Statistics.

MS means mean square. MSbetween is the variance between groups, and MSwithin is the variance within groups.

MSbetween and MSwithin can be written as follows:

  • \(M{S}_{\text{between}}=\frac{S{S}_{\text{between}}}{d{f}_{\text{between}}}=\frac{S{S}_{\text{between}}}{k-1}\)
  • \(M{S}_{within}=\frac{S{S}_{within}}{d{f}_{within}}=\frac{S{S}_{within}}{n-k}\)
  • n = the sample size
  • dfnumerator = k – 1
  • dfdenominator = nk
  • s2 pooled = the mean of the sample variances (pooled variance)
  • \({s}_{\overset{\bar}{x}}{}^{2}\) = the variance of the sample means

Condensed — the full section is in OpenStax Statistics.

Notation

The notation for the F distribution is F ~ Fdf(num),df(denom),

where df(num) = dfbetween and df(denom) = dfwithin.

The mean for the F distribution is \(\mu =\frac{df(\text{denom})}{df(\text{denom})-2}.\)

The F Distribution and the F Ratio

Use the following information to answer the next seven exercises. Groups of men from three different areas of the country are to be tested for mean weight. The entries in are the weights for the different groups.

Group 1Group 2Group 3
216202170
198213165
240284182
187228197
176210201


Use the following information to answer the next eight exercises. Girls from four different soccer teams are to be tested for mean goals scored per game. The entries in are the goals per game for the different teams.

Team 1Team 2Team 3Team 4
1203
2314
0214
3403
2402

Facts About the F Distribution

The following are facts about the F distribution:

  • The curve is not symmetrical but skewed to the right.
  • There is a different curve for each set of dfs.
  • The F statistic is greater than or equal to zero.
  • As the degrees of freedom for the numerator and for the denominator get larger, the curve approximates the normal.
  • Other uses for the F distribution include comparing two variances and two-way analysis of variance. Two-way analysis is beyond the scope of this chapter.
Example

Try it.

Let’s return to the slicing tomato exercise in . The means of the tomato yields under the five mulching conditions are represented by μ1, μ2, μ3, μ4, μ5. We will conduct a hypothesis test to determine if all means are the same or at least one is different. Using a significance level of 5 percent, test the null hypothesis that there is no difference in mean yields among the five groups against the alternative hypothesis that at least one mean is different from the rest.

Solution

The null and alternative hypotheses are as follows:

H0: μ1 = μ2 = μ3 = μ4 = μ5

Ha: μi ≠ μj for some i ≠ j

The one-way ANOVA results are shown in

Source of VariationSum of Squares (SS)Degrees of Freedom (df)Mean Square (MS)F
Factor (Between)36,648,5615 – 1 = 4 \(\frac{\text{36,648,561}}{\text{4}}\text{ = 9,162,140}\) \[\frac{\text{9,162,140}}{\text{2,044,672}\text{.6}}\text{ = 4}\text{.4810}\]
Error (Within)20,446,72615 – 5 = 10 \[\frac{\text{20,446,726}}{\text{10}}\text{ = 2,044,672}\text{.6}\]
Total57,095,28715 – 1 = 14

Distribution for the test: F4,10

df(num) = 5 – 1 = 4

df(denom) = 15 – 5 = 10

Test statistic: F = 4.4810

Probability statement: p-value = P(F > 4.481) = 0.0248

Compare α and the p-value: α = 0.05, p-value = 0.0248

Make a decision: Since α > p-value, we reject H0.

Conclusion: At the 5 percent significance level, we have reasonably strong evidence that differences in mean yields for slicing tomato plants grown under different mulching conditions are unlikely to be due to chance alone. We may conclude that at least some of the mulches led to different mean yields.

Condensed — the full section is in OpenStax Statistics.

Facts About the F Distribution

Use the following information to answer the next seven exercises. Four basketball teams took a random sample of players regarding how high each player can jump (in inches). The results are shown in .

Team 1Team 2Team 3Team 4Team 5
3632483841
4235504439
5138394640


Use the following information to answer the next seven exercises. A video game developer is testing a new game on three different groups. Each group represents a different target market for the game. The developer collects scores from a random sample from each group. The results are shown in .

Group AGroup BGroup C
101151101
108149109
98160198
107112186
111126160


Use the following information to answer the next three exercises. Suppose a group is interested in determining whether teenagers obtain their drivers licenses at approximately the same average age across the country. Suppose that the following data are randomly collected from five teenagers in each region of the country. The numbers represent the age at which teenagers obtained their drivers licenses.

Northeast South West Central East
16.316.916.416.217.1
16.116.516.516.617.2
16.416.416.616.516.6
16.516.216.116.416.8
\(\overset{\bar}{x}=\) ________________________________________
\({s}^{2}=\) ________________________________________

Enter the data into your calculator or computer.

State the decisions and conclusions (in complete sentences) for the following preconceived levels of α.

Test of Two Variances

Another use of the F distribution is testing two variances. It is often desirable to compare two variances rather than two averages. For instance, college administrators would like two college professors grading exams to have the same variation in their grading. For a lid to fit a container, the variation in the lid and the container should be the same. A supermarket might be interested in the variability of check-out times for two checkers.

To perform a F test of two variances, it is important that the following are true:

  • The populations from which the two samples are drawn are normally distributed.
  • The two populations are independent of each other.

Unlike most other tests in this book, the F test for equality of two variances is very sensitive to deviations from normality. If the two distributions are not normal, the test can give higher p-values than it should, or lower ones, in ways that are unpredictable. Many texts suggest that students not use this test at all, but in the interest of completeness we include it here.

Suppose we sample randomly from two independent normal populations. Let \({\sigma }_{1}^{2}\) and \({\sigma }_{2}^{2}\) be the population variances and \({s}_{1}^{2}\) and \({s}_{2}^{2}\) be the sample variances. Let the sample sizes be n1 and n2. Since we are interested in comparing the two sample variances, we use the F ratio

\[F=\frac{[\frac{{({s}_{1})}^{2}}{{({\sigma }_{1})}^{2}}]}{[\frac{{({s}_{2})}^{2}}{{({\sigma }_{2})}^{2}}]}.\]

F has the distribution F ~ F(n1 – 1, n2 – 1),

where n1 – 1 are the degrees of freedom for the numerator and n2 – 1 are the degrees of freedom for the denominator.

Condensed — the full section is in OpenStax Statistics.

Test of Two Variances

Use the following information to answer the next two exercises. There are two assumptions that must be true to perform an F test of two variances.

Use the following information to answer the next seven exercises. Two coworkers commute from the same building. They are interested in whether there is any variation in the time it takes them to drive to work. They each record their times for 20 commutes. The first worker’s times have a variance of 12.1. The second worker’s times have a variance of 16.9. The first worker thinks that he is more consistent with his commute times. Test the claim at the 10 percent level. Assume that commute times are normally distributed.

Use the following information to answer the next four exercises. Two students are interested in whether there is variation in their test scores for math class. There are 15 total math tests they have taken so far. The first student’s grades have a standard deviation of 38.1. The second student’s grades have a standard deviation of 22.5. The second student thinks his scores are more consistent.


Use the following information to answer the next three exercises. Two cyclists are comparing the variances of their overall paces going uphill. Each cyclist records his or her speeds going up 35 hills. The first cyclist has a variance of 23.8, and the second cyclist has a variance of 32.1. The cyclists want to see if their variances are the same or different. Assume that speeds are normally distributed.

Beispiel: variance of 2, 4, 4, 4, 5, 5, 7, 9

Variance of 2, 4, 4, 4, 5, 5, 7, 9

2,\ 4,\ 4,\ 4,\ 5,\ 5,\ 7,\ 9

Schritt für Schritt

  1. 2, 4, 4, 4, 5, 5, 7, 9

    8 values.

  2. \bar{x} = \frac{2 + 4 + 4 + 4 + 5 + 5 + 7 + 9}{8} = \frac{40}{8} = 5

    Mean: add them up and divide by how many there are.

  3. (2 - 5)^2 = 9 ,\; (4 - 5)^2 = 1 ,\; (4 - 5)^2 = 1 ,\; (4 - 5)^2 = 1 ,\; (5 - 5)^2 = 0 ,\; (5 - 5)^2 = 0 ,\; \dots

    Squared deviations from the mean.

  4. \sigma^2 = \frac{\sum (x_i - \bar x)^2}{n} = 4

    Population variance (divide by n).

  5. s^2 = \frac{\sum (x_i - \bar x)^2}{n - 1} = \frac{32}{7}

    Sample variance (divide by n − 1).

  6. \sigma = \sqrt{4} = 2,\quad s = \frac{4 \sqrt{14}}{7} \approx 2.1381

    Standard deviation is the square root of the variance.

Die Antwort aufzeigen
4

Practice (40)

Try each one on paper first. Reveal the answer to check; verified ones can be opened in the solver for every step.

  1. Write one assumption.

    Die Antwort aufzeigen

    Each population from which a sample is taken is assumed to be normal.

  2. Write another assumption.

  3. Write a third assumption.

    Die Antwort aufzeigen

    The populations are assumed to have equal standard deviations (or variances).

  4. Write a fourth assumption.

  5. Write the final assumption.

    Die Antwort aufzeigen

    The response is a numerical value.

  6. State the null hypothesis for a one-way ANOVA test if there are four groups.

  7. State the alternative hypothesis for a one-way ANOVA test if there are three groups.

    Die Antwort aufzeigen

    Ha: At least two of the group means μ1, μ2, μ3 are not equal.

  8. When do you use an ANOVA test?

  9. Three different traffic routes are tested for mean driving time. The entries in the are the driving times in minutes on the three different routes.

    Route 1Route 2Route 3
    302716
    322941
    272822
    353631

    State SSbetween, SSwithin, and the F statistic.

    Die Antwort aufzeigen

    SSbetween = 26
    SSwithin = 441
    F = 0.2653

  10. Suppose a group is interested in determining whether teenagers obtain their drivers licenses at approximately the same average age across the country. Suppose that the following data are randomly collected from five teenagers in each region of the country. The numbers represent the age at which teenagers obtained their drivers licenses.

    NortheastSouthWestCentralEast
    16.316.916.416.217.1
    16.116.516.516.617.2
    16.416.416.616.516.6
    16.516.216.116.416.8
    \(\overset{\bar}{x}=\) ________________________________________
    \({s}^{2}=\) ________________________________________

    State the hypotheses.

    H0: ____________

    Ha: ____________

  11. As part of an experiment to see how different types of soil cover would affect slicing tomato production, Marist College students grew tomato plants under different soil cover conditions. Groups of three plants each had one of the following treatments:

    • Bare soil
    • A commercial ground cover
    • Black plastic
    • Straw
    • Compost

    All plants grew under the same conditions and were the same variety. Students recorded the weight in grams of tomatoes produced by each of the n = 15 plants, as seen in .

    Bare: n1 = 3Ground Cover: n2 = 3Plastic: n3 = 3Straw: n4 = 3Compost: n5 = 3
    2,6255,3486,5837,2856,277
    2,9975,6828,5606,8977,818
    4,9155,4823,8309,2308,677


    Create the one-way ANOVA table.

    Die Antwort aufzeigen

    Enter the data into lists L1, L2, L3, L4 and L5. Press STAT and arrow over to TESTS. Arrow down to ANOVA. Press ENTER and enter L1, L2, L3, L4, L5). Press ENTER. The table was filled in with the results from the calculator.

    One-Way ANOVA table:

    Source of VariationSum of Squares (SS)Degrees of Freedom (df)Mean Square (MS)F
    Factor (Between)36,648,5615 – 1 = 4 \(\frac{36,648,561}{4}=9,162,140\) \(\frac{9,162,140}{2,044,672.6}=4.4810\)
    Error (Within)20,446,72615 – 5 = 10 \(\frac{20,446,726}{10}=2,044,672.6\)
    Total57,095,28715 – 1 = 14
  12. What is the sum of squares factor?

    Die Antwort aufzeigen

    4,939.2

  13. What is the sum of squares error?

  14. What is the df for the numerator?

    Die Antwort aufzeigen

    2

  15. What is the df for the denominator?

  16. What is the mean square factor?

    Die Antwort aufzeigen

    2,469.6

  17. What is the mean square error?

  18. What is the F statistic?

    Die Antwort aufzeigen

    3.7416

  19. What is SSbetween?

  20. What is the df for the numerator?

    Die Antwort aufzeigen

    3

  21. What is MSbetween?

  22. What is SSwithin?

    Die Antwort aufzeigen

    13.2

  23. What is the df for the denominator?

  24. What is MSwithin?

    Die Antwort aufzeigen

    0.825

  25. What is the F statistic?

  26. Judging by the F statistic, do you think it is likely or unlikely that you will reject the null hypothesis?

    Die Antwort aufzeigen

    Because a one-way ANOVA test is always right-tailed, a high F statistic corresponds to a low p value, so it is likely that we will reject the null hypothesis.

  27. degrees of freedom – numerator: df(num) = _________

  28. degrees of freedom – denominator: df(denom) = ________

    Die Antwort aufzeigen

    df(denom) = 15

  29. F statistic = ________

  30. Let’s return to the slicing tomato exercise in . The means of the tomato yields under the five mulching conditions are represented by μ1, μ2, μ3, μ4, μ5. We will conduct a hypothesis test to determine if all means are the same or at least one is different. Using a significance level of 5 percent, test the null hypothesis that there is no difference in mean yields among the five groups against the alternative hypothesis that at least one mean is different from the rest.

    Die Antwort aufzeigen

    The null and alternative hypotheses are as follows:

    H0: μ1 = μ2 = μ3 = μ4 = μ5

    Ha: μi ≠ μj for some i ≠ j

    The one-way ANOVA results are shown in

    Source of VariationSum of Squares (SS)Degrees of Freedom (df)Mean Square (MS)F
    Factor (Between)36,648,5615 – 1 = 4 \(\frac{\text{36,648,561}}{\text{4}}\text{ = 9,162,140}\) \[\frac{\text{9,162,140}}{\text{2,044,672}\text{.6}}\text{ = 4}\text{.4810}\]
    Error (Within)20,446,72615 – 5 = 10 \[\frac{\text{20,446,726}}{\text{10}}\text{ = 2,044,672}\text{.6}\]
    Total57,095,28715 – 1 = 14

    Distribution for the test: F4,10

    df(num) = 5 – 1 = 4

    df(denom) = 15 – 5 = 10

    Test statistic: F = 4.4810

    Probability statement: p-value = P(F > 4.481) = 0.0248

    Compare α and the p-value: α = 0.05, p-value = 0.0248

    Make a decision: Since α > p-value, we reject H0.

    Conclusion: At the 5 percent significance level, we have reasonably strong evidence that differences in mean yields for slicing tomato plants grown under different mulching conditions are unlikely to be due to chance alone. We may conclude that at least some of the mulches led to different mean yields.

  31. MRSA, or Staphylococcus aureus, can cause serious bacterial infections in hospital patients. shows various colony counts from different patients who may or may not have MRSA. The data from the table is plotted in .

    Conc = 0.6Conc = 0.8Conc = 1.0Conc = 1.2Conc = 1.4
    916223027
    6693147199168
    9882120148132

    Plot of the data for the different concentrations:

    Test whether the mean numbers of colonies are the same or are different. Construct the ANOVA table by hand or by using a TI-83, 83+, or 84+ calculator, find the p-value, and state your conclusion. Use a 5 percent significance level.

    Die Antwort aufzeigen

    While there are differences in the spreads between the groups (see ), the differences do not appear to be big enough to cause concern.

    We test for the equality of mean number of colonies:

    H0 : μ1 = μ2 = μ3 = μ4 = μ5

    Ha: μiμj some ij

    The one-way ANOVA table results are shown in .

    Source of VariationSum of Squares (SS)Degrees of Freedom (df)Mean Square (MS)F
    Factor (Between)10,2335 – 1 = 4 \(\frac{\text{10,233}}{\text{4}}\text{ = 2,558}\text{.25}\) \(\frac{\text{2,558}\text{.25}}{\text{4,194}\text{.9}}\text{ = 0}\text{.6099}\)
    Error (Within)41,94915 – 5 = 10
    Total52,18215 – 1 = 14 \(\frac{\text{41,949}}{\text{10}}\text{ = 4,194}\text{.9}\)

    Distribution for the test: F4,10

    Probability Statement: p-value = P(F > 0.6099) = 0.6649.

    Compare α and the p-value: α = 0.05, p-value = 0.669, α > p-value

    Make a decision: Since α > p-value, we do not reject H0.

    Conclusion: At the 5% significance level, there is insufficient evidence from these data that different levels of tryptone will cause a significant difference in the mean number of bacterial colonies formed.

  32. Using a significance level of 1 percent, is there a difference in mean grades among the sororities?

    Die Antwort aufzeigen

    Let μ1, μ2, μ3, μ4 be the population means of the sororities. Remember that the null hypothesis claims that the sorority groups are from the same normal distribution. The alternate hypothesis says that at least two of the sorority groups come from populations with different normal distributions. Notice that the four sample sizes are each five.

    H0: μ1 = μ2 = μ3 = μ4

    Ha: Not all of the means μ1, μ2, μ3, μ4 are equal.

    Distribution for the test: F3,16

    where k = 4 groups and n = 20 samples in total.

    df(num)= k – 1 = 4 – 1 = 3

    df(denom) = nk = 20 – 4 = 16

    Calculate the test statistic: F = 2.23

    Graph

    Probability statement: p-value = P(F > 2.23) = 0.1241

    Compare α and the p-value: α = 0.01
    p-value = 0.1241
    α < p-value

    Make a decision: Since α < p-value, we cannot reject H0.

    Conclusion: There is not sufficient evidence to conclude that there is a difference among the mean grades for the sororities.

  33. Four sports teams took a random sample of players regarding their GPAs for the last year. The results are shown in .

    BasketballBaseballHockeyLacrosse
    3.62.14.02.0
    2.92.62.03.6
    2.53.92.63.9
    3.33.13.22.7
    3.83.43.22.5

    Use a significance level of 5 percent and determine if there is a difference in GPA among the teams.

    Die Antwort aufzeigen

    With a p-value of 0.9271, we do not reject the null hypothesis. There is not sufficient evidence to conclude that there is a difference among the GPAs for the sports teams.

  34. Does it appear that the three soils in which the bean plants were grown produce the same mean height? Test at a 3 percent level of significance.

    Die Antwort aufzeigen

    This time, we will perform the calculations that lead to the F' statistic. Notice that each group has the same number of plants, so we will use the formula F' = \(\frac{n⋅{s}_{\overset{\bar}{x}}{}^{2}}{{s}^{2}{}_{\text{pooled}}}\) .

    First, calculate the sample mean and sample variance of each group.

    Tommy's PlantsTara's PlantsNick's Plants
    Sample Mean24.225.424.4
    Sample Variance11.718.316.3

    Next, calculate the variance of the three group means by calculating the variance of 24.2, 25.4, and 24.4. Variance of the group means = 0.413 = \({s}_{\overset{\bar}{x}}{}^{2}\),

    then MSbetween = \(n{s}_{\overset{\bar}{x}}{}^{2}\) = (5)(0.413) where n = 5 is the sample size (number of plants each child grew).

    Calculate the mean of the three sample variances (11.7, 18.3, and 16.3). Mean of the sample variances = 15.433 = s2pooled,

    then MSwithin = s2pooled = 15.433.

    The F statistic (or F ratio) is \(F=\frac{M{S}_{\text{between}}}{M{S}_{\text{within}}}=\frac{n{s}_{\overset{\bar}{x}}{}^{2}}{{s}^{2}{}_{pooled}}=\frac{(5)(0.413)}{15.433}=0.134\text{.}\)

    The dfs for the numerator = the number of groups – 1 = 3 – 1 = 2.

    The dfs for the denominator = the total number of samples – the number of groups = 15 – 3 = 12.

    The distribution for the test is F2,12 and the F statistic is F = 0.134.

    The p-value is P(F > 0.134) = 0.8759.

    Decision: Since α = 0.03 and the p-value = 0.8759, we do not reject H0. Why?

    Conclusion: With a 3 percent level of significance from the sample data, the evidence is not sufficient to conclude that the mean heights of the bean plants are different.

  35. Another fourth grader also grew bean plants, but in a jelly-like mass. The heights were (in inches) 24, 28, 25, 30, and 32. Do a one-way ANOVA test on the four groups. Are the heights of the bean plants different? Use the same method as shown in .

    Die Antwort aufzeigen
    • F = 0.9496
    • p-value = 0.4402

    From the sample data, the evidence is not sufficient to conclude that the mean heights of the bean plants are different.

  36. An F statistic can have what values?

  37. What happens to the curves as the degrees of freedom for the numerator and the denominator get larger?

    Die Antwort aufzeigen

    The curves approximate the normal distribution.

  38. What is the df(num)?

  39. What is the df(denom)?

    Die Antwort aufzeigen

    10

  40. What are the sum of squares and mean squares factors?

Versuch es selbst.

Parts of this page are adapted from OpenStax Statistics (CC BY 4.0). Condensed and re-explained here; errors are ours.

Mehr in Statistics & Probability