Statistics From Scratch by Rob Brotherton

14  ANOVA

  • Introduction
  • 1  Variables & Measurement
  • 2  Frequency
  • 3  Central Tendency
  • 4  Variability
  • 5  \(z\)-Scores
  • 6  Probability
  • 7  Sampling
  • 8  Hypothesis Testing
  • 9  Statistical Power
  • 10  Confidence Intervals
  • 11  The \(t\) test
  • 12  Independent-samples \(t\) test
  • 13  Related-samples \(t\) test
  • 14  ANOVA
  • 15  Related-samples ANOVA
  • 16  Factorial ANOVA
  • 17  Correlation
  • 18  Regression
  • References

Table of contents

  • Comparing two groups
    • Sources of variability
  • Analysis of variance
    • Three types of variance
    • Sums of squares
    • Degrees of freedom
    • Mean squares
    • The \(F\) ratio
  • The \(F\) distribution(s)
    • The \(F\) table
    • From \(t\) to \(F\)
  • Comparing more than two groups
    • ANOVA terminology
    • Three groups, the same logic
  • Hypothesis testing with ANOVA
    • Step 1: State the hypotheses
    • Step 2: Set the decision criteria
    • Step 3: Collect and analyze the data
    • Step 4: Make a decision
    • Step 5: Estimate the effect, compare the groups, and consider power
  • Reporting and interpreting results
    • Assumptions

14  ANOVA

Animated family of F distribution curves.

We’re leaving behind the \(t\) statistic and moving on to ANOVA, which stands for analysis of variance. This isn’t as radical a departure as it might seem, though. As we’ll see, the ANOVA procedure is just a more general version of what we’ve used the \(t\) tests to achieve. We’ll start by seeing how the \(t\) and ANOVA approaches can both be applied to the same two-group comparison. Then we’ll discuss what ANOVA is good for: allowing us to move beyond comparing just two groups. We’ll use ANOVA’s \(F\) statistic to test a hypothesis comparing three groups.

Comparing two groups

It’s been a while since we talked about Spider-Man. Back in Chapter 5 we imagined testing Peter Parker’s reaction times following a radioactive spider bite, and in Chapter 8 we tested a hypothesis using the \(z\) test and a sample of three Spider-People. Now let’s suppose we want to do some more research. We’ve had an important realization about our findings from Chapter 8: we only tested a single sample of kids who had all been bitten by the same kind of radioactive spider. Even if we reject the null hypothesis, we’re left with a question of causality. How do we know that the radioactivity was the thing that led to their apparent Spidey-Sense? Perhaps being bitten by any old spider would affect one’s reaction times.

So now we want to compare the effects of different kinds of spider bites on reaction times. We set up a little study with two independent samples. One group of participants is bitten by a radioactive spider, and another batch is bitten by an ordinary spider. (Don’t worry, they all signed the informed consent form.) Then everyone takes the same reaction time test.

Table 14.1: Reaction times (ms) for the two spider-bite conditions.
🕷️ Radioactive bite 🕷️ Ordinary bite
\(189\) \(310\)
\(161\) \(219\)
\(237\) \(303\)
\(169\) \(264\)
\(M = 189\) \(M = 274\)

You’ll recognize this as a situation where we could use the independent-samples \(t\) test. The numerator is the difference between sample means, found by subtracting one from the other: \(189 - 274 = -85\) milliseconds. We can pool the samples’ variances to get \(s_p^2 = 1{,}458.3\). The denominator is the estimated standard error of the mean difference, the size of difference between means we’d typically see by chance. This works out to \(27.0\) milliseconds. (You’re welcome to check my math.)

That makes for a \(t\) statistic of \(-3.15\). Since you’re pretty familiar with \(t\) distributions by now, you might guess that that’s big enough of a \(t\) value to be statistically significant. And you’d be right; it falls below the lower critical value of \(-2.447\) for \(df = 6\). So we can reject the null hypothesis that the two populations have the same mean reaction time.

Notice a few things about this procedure. For one thing, the numerator and denominator are both in the original units of measurement, milliseconds. (They have to be in the same units for the ratio to make sense.) And because we subtract one mean from the other, the resulting \(t\) statistic can be positive or negative; it quantifies a difference with a direction, and the test can be two-tailed.

I’m reiterating all this because the \(t\) statistic is just one possible way of comparing groups, not the only way. What are we interested in, really? Variability: how much do the group means vary from one another, and how much should we expect them to vary by chance? Subtracting one mean from another is a convenient way to quantify that difference for two groups. But it is limited to comparing exactly two means. What if we want to compare three, or more, with a single test? That’s where ANOVA comes in. To begin to see its logic, let’s first distill the \(t\) statistic down to its conceptual essence.

Sources of variability

Let’s think about the \(t\) equation again, in terms of what contributes to the numerator and the denominator—what would make each larger or smaller?

\[ t = \frac{(M_1 - M_2) - (\mu_1 - \mu_2)}{s_{M_1 - M_2}} \]

Starting with the numerator, why might the group means be different from one another? In other words, what contributes to the variability between groups? One contributor would be a real treatment effect. The treatment effect causes an increase or decrease in people’s scores, which causes the groups to have different averages. But a second reason the groups might differ is pure chance. Thanks to sampling error, any given sample mean needn’t be exactly equal to that of its population. So even if two samples are drawn from identical populations, there may be some difference between them due to chance. So let’s say the numerator is composed of any treatment effect and chance. (‘Chance’ here includes sampling error and any of the other reasons people’s reaction times differ, apart from the treatment we’re comparing. In the next chapter we’ll be a bit more specific about that.)

The denominator, on the other hand, is all chance. Remember, the standard error quantifies the variability of the sampling distribution under the null hypothesis. It’s the standard deviation of all the mean differences we’d see over the course of repeated sampling, assuming there’s no treatment effect.

So a conceptual distillation of the \(t\) equation gives treatment effect and chance in the numerator, and just chance in the denominator. More variability in the populations increases the role of chance in both numerator and denominator. A treatment effect, on the other hand, contributes to the numerator without increasing the denominator. By dividing these quantities, the ratio gives a measure of how much treatment effect there seems to be over and above chance differences.

If we wanted to produce a new kind of ratio with this same structure, how might we do it?

Analysis of variance

The solution came from Ronald Fisher. I mentioned him in passing in Chapter 11, when we talked about the \(t\) statistic. William Sealy Gosset had laid the groundwork for the \(t\) statistic, but it was Fisher who formalized it and gave it the name we use today. So Fisher was well aware of the \(t\) statistic as a tool for comparing two groups.

Separately, Fisher was also working in the field of genetics. He coined the term “variance” and developed a way of partitioning variance into different components, each due to a different cause, like how much of the variability in people’s heights comes from genetics versus environment (Fisher, 1918). A little later, Fisher applied the technique to agricultural research, asking questions of data like, how much of the variability in crop production can be attributed to things like the soil, fertilizer, drainage, and so on, and how much of it is just up to chance. This work brought Fisher and Gosset back together: Gosset’s 1923 paper, On Testing Varieties of Cereals, included a note contributed by Fisher setting out the analysis (Student, 1923).

So ANOVA wasn’t developed as an extension of the \(t\) test approach; it came about separately but out of the same intellectual milieu. Pretty soon, Fisher unified the approaches under a coherent statistical framework, formalizing the common mathematical underpinnings.

You’ll remember that we first encountered variance in Chapter 4, as a step along the way to calculating the standard deviation. It’s a funny quirk of history that standard deviation was already well established before Fisher gave variance its name and treated it as a measure worth studying in its own right. Mathematically, that seems backwards: standard deviation is the square root of variance, so variance is a mathematical precursor to standard deviation. Fisher’s insight was to show what we could do by keeping things squared, rather than shoehorning things back into the original units of measurement by taking the square root (as the denominator of the \(t\) statistic does).

Three types of variance

The key is the idea of partitioning variance into different components. Remember, variance is based on squared deviations from a mean. We can produce different types of variance by considering different deviations from different means. For the kind of data we’re dealing with, we can think in terms of partitioning the total variance into two components: between-groups variance and within-groups variance.

Total variance measures the overall variability in the data. We treat the scores as one single set, find the grand mean of them all together, and look at the squared deviation of each score from that grand mean. Why might scores deviate from that mean? Maybe because of a treatment effect pushing the scores apart across the different groups. And maybe because of chance differences among people, within and between the groups. The total variability, as the name suggests, will capture it all.

Within-groups variance measures the variability of scores around their own group means. Why might scores vary within a group? Chance is a factor, as usual. But it can’t be because of a treatment effect, since everyone in a group got the same treatment. So within-groups variability isolates chance, much like the denominator of the \(t\) statistic.

Between-groups variance measures how far the individual group means fall from the grand mean. Say group A’s mean is a bit lower than the overall mean of all the scores, and group B’s mean is a bit higher. Why might that be? Maybe there’s a real treatment effect pushing them apart. Or maybe it’s just chance. Both factors contribute, much like the numerator of the \(t\) statistic.

See where we’re going with this? If we can partition the total variability into these two components, we can create for ourselves a new statistic. Dividing the between-groups variance by the within-groups variance will produce a ratio with the same conceptual structure as the \(t\) statistic: treatment effect plus chance in the numerator, chance alone in the denominator.

Sums of squares

So how do we actually calculate the variance components we need? A variance requires two things: a sum of squared deviations, and degrees of freedom to divide it by. So let’s start with the sums of squares. Before I give you the equations, let’s step through it visually.

Activity 14.1: Seeing the logic of ANOVA
Interactive diagram showing two groups of scores, then total, within-groups, and between-groups squared deviations.

For our thought experiment, we have two groups: people bitten by radioactive spiders and people bitten by ordinary spiders. Those groups represent two hypothetical populations, shown as curves. From those populations we obtain our sample data, shown as the 8 dots. In this case, there really is a difference between the populations; the curves have different centers. But how can we use the samples to establish that difference statistically?

We’ll start by quantifying the total variability. To do so, we ignore group membership and compute the mean of every score all together. We’ll call this the grand mean.

Now we follow the usual procedure for calculating the sum of squared deviations. We begin by finding each score’s deviation from the grand mean. Longer lines represent scores that contribute more total variability.

Then we turn every deviation into a square. The area of each square is that score’s squared deviation.

Then we sum the squared deviations. That’s represented by dropping them into the big square representing the total sum of squares. Note that the total square is not drawn to scale; I’ve had to shrink it to fit on the page. The important thing is not so much the size of the total, but the ratio of its parts, as we’ll see in a moment.

Next we’ll turn to within-groups variability. We follow the same procedure, but consider each score relative to its own group mean.

So we draw each score’s deviation from its own group mean. Remember, within each group, everyone received the same treatment. So these deviations represent variability due to chance alone, not treatment effects.

We square the deviations…

And now we can sum these squares. We’ll drop them into the total box we created before, so we can see the within-groups sum of squared deviations as a portion of the whole. We have partitioned out that component of the variability.

Lastly, we’ll compute the between-groups variability. We still keep track of the groups, but this time we imagine that there’s no within-groups variability at all (since we just calculated it separately). To achieve that, we’ll picture that every dot gets shifted to its group mean. Then we’ll consider their deviations from the grand mean.

Now we see each group mean’s deviation from the grand mean. With two equally sized groups like these, the two deviations have to sum to zero, so they must be equal and opposite. Consider how that constraint might affect the degrees of freedom for the between-groups component of variability.

As before, we turn each mean’s deviation into a square. I’m just showing one square for each group mean, but each square represents all four scores in that group.

So we count each square four times. (We’ll see a deeper reason for this in Section 14.3.) These copies form the between-groups sum of squares, the remaining portion of the total variability.

Hopefully you see that we’re not really doing anything too new. We’re using the same procedure for calculating the sum of squared deviations that we learned back in Chapter 4, just chunking up the data to look at different sources of variability.

The equations we’ll use need a few symbols.

Table 14.2: ANOVA notation.
Symbol Meaning
\(k\) Number of groups in the study
\(N\) Total number of scores in the study
\(M_{\text{grand}}\) Grand mean: the mean of all \(N\) scores
\(n_{\text{group}}\) Number of scores in a group. There are \(k\) of these, one for each group.
\(M_{\text{group}}\) Mean of a group. There are \(k\) of these too.

Here are the equations1 describing what we just did in Activity 14.1.

\[ \begin{align} SS_{\text{total}} &= \Sigma (X - M_{\text{grand}})^2 \\ SS_{\text{within}} &= \Sigma (X - M_{\text{group}})^2 \\ SS_{\text{between}} &= \Sigma n_{\text{group}}(M_{\text{group}} - M_{\text{grand}})^2 \end{align} \]

The first two equations involve every score, summing squared deviations from the grand mean in the case of \(SS_{\text{total}}\) and from the relevant group mean in the case of \(SS_{\text{within}}\). The between-groups equation sums the squared deviation of each group mean from the grand mean, with each squared deviation multiplied by that group’s number of scores, \(n_{\text{group}}\).

For our 8 spider-bite scores in Table 14.1, the grand mean is 231.5 ms, so this works out to:

\[ \begin{align} SS_{\text{total}} &= 23{,}200 \\ SS_{\text{within}} &= 3{,}488 + 5{,}262 = 8{,}750 \\ SS_{\text{between}} &= 4(-42.5)^2 + 4(42.5)^2 = 14{,}450 \end{align} \]

Notice that \(SS_{\text{total}} = SS_{\text{within}} + SS_{\text{between}}\). This holds for any set of groups, not just our spider data. The total is literally the sum of its parts.

Notice also that each equation is a variation on a theme rather than a whole new thing. Each one sums squared deviations from a mean; what changes each time is how we group the scores to get those mean(s) and devations. For the total, we treat all the scores as one big, undifferentiated group and take each score’s deviation from their grand mean. For within and between, we group the scores by bite type, and ask either how far the scores fall from their own group’s mean, or how far each group’s mean falls from the grand mean. (When we meet variations of ANOVA in the next two chapters we’ll find new sources of variability by running with the theme of grouping the same scores in different ways.)

Degrees of freedom

Each sum of squares has its own degrees of freedom. Here two symbols from Table 14.2 come in handy: \(k\), the number of groups, and \(N\), the total number of scores in the study. (In the past we’ve used \(N\) to denote the number of individuals in a population; here it’s the total number of scores in the study, to distinguish that total from lowercase \(n_{\text{group}}\).) In our spider bite data, we have \(k = 2\) groups and \(N = 8\) scores.

Before I tell you the equations for degrees of freedom, see if you can guess. A hint: think about how many deviations are used to compute each sum of squares, and how many of those deviations are free to vary in each case.

How many degrees of freedom?

0 of 3
1

For our two groups of four scores, what are the degrees of freedom for the total sum of squares?

Response options

6

7

8

Hint

We found eight scores’ deviations from one grand mean. How many are free to vary if they must sum to zero?

Answer

7

Explanation

Once seven deviations are known, the eighth is determined, leaving seven degrees of freedom.

2

What are the degrees of freedom for the within-groups sum of squares?

Response options

3

6

7

Hint

We found four scores’ deviations from their own group mean in each of two groups. The deviations must sum to zero separately within each group.

Answer

6

Explanation

Each group has three freely varying deviations. Across two groups, that gives six degrees of freedom.

3

What are the degrees of freedom for the between-groups sum of squares?

Response options

1

2

7

Hint

We found two group means’ deviations from one grand mean. With equally sized groups, those deviations must be equal and opposite.

Answer

1

Explanation

Once one group mean’s deviation is known, the other is determined, leaving one degree of freedom.

The logic is the same in all three cases. Deviations from a mean must sum to zero, so once all but one of them are known, the last one is determined. Each mean we measure deviations from costs us one degree of freedom.

For \(SS_{\text{total}}\), we computed the deviation of all \(N\) scores from a single mean, the grand mean. So \(df_{\text{total}} = N - 1\), the total number of scores minus one.

For \(SS_{\text{within}}\), we computed the deviation of each score from its own group mean. So that’s \(N\) scores, deviating from \(k\) means, and \(df_{\text{within}} = N - k\), the total number of scores minus the number of groups.

For \(SS_{\text{between}}\), we computed the deviation of each group mean from the grand mean. So that’s \(k\) means, deviating from a single grand mean, and \(df_{\text{between}} = k - 1\), the number of groups minus one.

So for our spider data:

\[ \begin{align} df_{\text{total}} &= N - 1 = 8 - 1 = 7 \\ df_{\text{within}} &= N - k = 8 - 2 = 6 \\ df_{\text{between}} &= k - 1 = 2 - 1 = 1 \end{align} \]

The degrees of freedom partition just like the sums of squares: \(df_{\text{total}} = df_{\text{within}} + df_{\text{between}}\), or \(7 = 6 + 1\).

Mean squares

So now we have a few values of \(SS\), each with a corresponding \(df\). Dividing each \(SS\) by its \(df\) gives a variance. In the context of ANOVA, these variance components get a new name: mean squares (\(MS\)). It’s a helpful name; their values represent the average squared deviation of each component, the sum of squared deviations divided by the number of deviations which were free to vary.

So we have \(MS_{\text{between}}\), the between-groups variance, and \(MS_{\text{within}}\), the within-groups variance.

\[ \begin{align} MS_{\text{between}} &= \frac{SS_{\text{between}}}{df_{\text{between}}} \\ MS_{\text{within}} &= \frac{SS_{\text{within}}}{df_{\text{within}}} \end{align} \]

I didn’t include an \(MS_{\text{total}}\). We only need to compute \(MS\) for the between-groups and within-groups variability, since those are the two components that will go into our new ratio.

For the spider data, this comes to:

\[ \begin{align} MS_{\text{between}} &= \frac{14{,}450}{1} = 14{,}450 \\ MS_{\text{within}} &= \frac{8{,}750}{6} = 1{,}458.3 \end{align} \]

The \(F\) ratio

And now we can form a new ratio, the \(F\) ratio (named in Fisher’s honor by another statistical pioneer, George Snedecor, 1934). For the independent-samples design we are analyzing here:

\[ F = \frac{MS_{\text{between}}}{MS_{\text{within}}} \]

For our spider data we end up with:

\[ F = \frac{14{,}450}{1{,}458.3} \approx 9.91 \]

Note that the sums of squares weren’t so very different from one another for these data: \(SS_{\text{between}} = 14{,}450\) and \(SS_{\text{within}} = 8{,}750\). But their degrees of freedom were very different: \(df_{\text{between}} = 1\) and \(df_{\text{within}} = 6\). Dividing by six made the within-groups mean square much smaller, while dividing by one left the between-groups sum unchanged. Activity 14.2 visualizes the process of going from the sums of squares to the mean squares, and the resulting \(F\) ratio.

Activity 14.2: From sums of squares to \(F\)
Interactive diagram showing the total sum of squares partitioned into between-groups and within-groups layers, which separate into two squares, each then broken into as many equal squares as its degrees of freedom to give the between-groups and within-groups mean squares, which finally stack as a fraction: the F ratio.

Here are the sums of squares we calculated earlier: between plus within make up the total. We can’t just compare the sums, though. The sums were made up of different numbers of squared deviations, so before we compare them, we divide each by its degrees of freedom—the number of deviations in the sum that were free to vary.

First we separate the two components. Each becomes a square in its own right, keeping the same area it had in the total. These are still sums of squares, not mean squares.

To get \(MS_{\text{between}}\), we divide the between-groups square into as many equal pieces as its degrees of freedom. Here \(df_{\text{between}} = 1\), so there is only one piece: the whole square. The mean square is still 14,450.

For \(MS_{\text{within}}\), we divide the within-groups square into six equal pieces. One of those pieces is the mean square: \(8{,}750 / 6 = 1{,}458.3\). Notice how much smaller it is than the sum we started with.

Now we have one mean square over the other, which is the \(F\) ratio. The area of the between-groups mean square is about 9.91 times that of the within-groups mean square, so \(F \approx 9.91\).

The \(F\) distribution(s)

So we’ve computed a whole new statistic, the \(F\) ratio. But to use it in a hypothesis test, we need to know its distribution under the null hypothesis. If the null is true (there is no treatment effect) and we take sample after sample, what shape would the distribution of all their \(F\)s form?

Let’s see!

Activity 14.3: Sampling the two estimates
Two groups of four reaction times are sampled again and again. When both come from one population, the between-groups and within-groups mean squares both land near the population variance, and their ratio F is usually near or below 1. With more spread in the population, both estimates grow together and the Fs follow the same curve.

We’re saying the null hypothesis is true: the two kinds of bite have the same population mean reaction time. So I’ve drawn two population curves with the same center (and same variability). The population variance is represented as the dashed square. Since there’s no treatment effect, that variance reflects the only source of variability in the data, and it will be captured in both the within-groups and between-groups mean squares.

Now we collect two samples. (The data is different from Table 14.1 because here we’re simulating repeated sampling under a true null.) First, we can compute \(MS_{\text{within}}\) from the deviations of each score from its group mean, just like we did in Activity 14.1. It comes out pretty close to the population variance, because it is effectively just estimating that quantity (which it would be whether there was a treatment effect or not).

Next we compute \(MS_{\text{between}}\) from the deviations of the group means from the grand mean, each squared deviation counted \(n = 4\) times. Why count each squared deviation four times? A mean of four scores has one quarter of the population variance, so multiplying by four puts this estimate back on the scale of the individual scores. With no treatment effect, it estimates the same population variance as \(MS_{\text{within}}\). That doesn’t mean they match in every sample: either estimate can come out larger, so \(F\) can fall below or above 1.

Dividing \(MS_{\text{between}}\) by \(MS_{\text{within}}\) gives the \(F\) ratio for this sample, which in this case is \(F = 1{,}233 / 1{,}503 = 0.82\). This value is then recorded in the tracker as the first entry. We’ll collect a bunch of these and see how they distribute.

Here’s the second set of samples. In this case \(MS_{\text{within}}\) came out quite a bit lower than \(\sigma^2\), and \(MS_{\text{between}}\) a lot lower. The two estimates vary independently of each other, and they’ll miss like that due to sampling error. The \(F\) for these samples comes to \(0.20\), which gets added to the tracker at the bottom.

The third sample has a relatively big difference between the group means, just by chance, and a small \(MS_{\text{within}}\), because the scores within each group happened to be fairly close together. This produces the biggest \(F\) so far, at \(2.13\). Again, the null is true and there’s no real difference, but sometimes sampling error will create an apparent difference by chance.

Now we take a bunch more samples, until we have 200 in total. The curve drawn over the pile is the mathematical \(F\) distribution with 1 and 6 degrees of freedom; the histogram of our 200 \(F\)s follows it pretty closely. The \(F\)s pile up mostly below 1, with a long right tail. The skew comes from the numerator. With just one degree of freedom, it is usually small but occasionally very large. This combines with the outsized effect of underestimates in the denominator (which gave the \(t\) distribution its heavier tails) to produce the long tail.

What if there was more variability in the population? We can increase \(\sigma^2\), making the population curves wider, and take 200 new samples. Both \(MS_{\text{between}}\) and \(MS_{\text{within}}\) come out bigger, since they’re now estimating a bigger \(\sigma^2\). But the \(F\) values still follow the same curve under the null, because both sides of the ratio scale up together.

What would an F of 0.60 tell us?

In another two-group study, \(F = 0.60\). Which interpretation fits?

Response options

The between-groups mean square is smaller than the within-groups mean square.

The treatment effect is negative.

The calculation must be wrong, because F cannot be below 1.

Answer

The between-groups mean square is smaller than the within-groups mean square.

Explanation

Either mean square can come out larger through sampling error, so \(F\) can fall below 1. It doesn’t carry a sign telling us which group has the higher mean.

The \(F\) table

The 200 samples in Activity 14.3 approximate one specific \(F\) distribution, the one with 1 and 6 degrees of freedom in its numerator and denominator respectively. But there are many different \(F\) distributions, one for each pair of degrees of freedom. The precise shape of the distribution, and therefore the exact value of \(F\) that cuts off, say, 5% of the distribution, changes with the degrees of freedom. So, as with the \(t\) distributions, we can use an \(F\) table to find the critical values.

An \(F\) table will generally look something like Table 14.3. The whole table gives values for an alpha of \(\alpha = .05\); we’d need a different table for a different alpha. Since we have two different degrees of freedom to deal with, one is listed along the top as the columns of the table—usually for the numerator, and labeled \(df_{\text{numerator}}\) or just \(df_1\). The other will be listed as rows, labeled \(df_{\text{denominator}}\) or \(df_2\). When you see \(F\) with the degrees of freedom in parentheses, it’s always in the order of numerator first and then denominator. So \(F(1, 6)\) means one degree of freedom for the numerator and six for the denominator, as in the two-group spider data.

So to find the critical value for our spider test, with an alpha of .05, you’d look for the column for \(1\) and the row for \(6\), and find that the critical value is \(5.99\). (Any other pair works the same way: \(F(3, 10)\), for example, has a critical value of \(3.71\).)

Table 14.3: Critical \(F\) values for \(\alpha = .05\). Columns give the numerator’s degrees of freedom, \(df_1\); rows give the denominator’s, \(df_2\).
F critical-value table for alpha .05, highlighting 5.99 for 1 and 6 degrees of freedom.
Activity 14.4: Exploring the \(F\) distributions
Explore how numerator and denominator degrees of freedom change the null F distribution. A dashed line marks F = 1, where the two mean squares are equal. The highest 5 percent is shaded; its cutoff changes with the degrees of freedom.

Here’s the \(F(1, 6)\) curve. Most of these \(F\)s fall below 1, with a long tail to the right. The highest 5% is cut off by \(F = 5.99\), as we saw in the table.

If we had the same two-group design but with more participants, say 30 in each group, we would have a different \(df\) for the denominator: \(df_2 = 58\). The curve changes a little: very large \(F\)s become less common, so the tail flattens a bit, more of the curve is below \(F = 1\), and the critical \(F\) that cuts off the top 5% is reduced from \(5.99\) to \(4.01\). Drag the \(df_2\) slider to see how changing the denominator’s degrees of freedom affects the curve and its critical value.

How about increasing the numerator’s degrees of freedom? This would mean comparing more groups. The pile near zero becomes a hump, and with both estimates more reliable, their ratio is concentrated closer to 1. Try dragging the \(df_1\) slider while keeping the denominator \(df_2\) high. Then try adjusting both, and notice that changes in each do different things to the curve.

From \(t\) to \(F\)

Returning to our spider data, with 1 and 6 degrees of freedom, our \(F\) of 9.91 exceeds the critical value of 5.99, so we reject the null hypothesis. That’s the same decision we reached with the \(t\) test.

That’s no coincidence; the two statistical treatments of the same data don’t just produce outcomes in the same ballpark. For two independent groups, using the pooled \(t\) test and this ANOVA, there is a precise relationship: \(F = t^2\). Our \(t\) was about \(-3.148\); squaring it gives about \(9.91\). Alternatively, taking the square root of \(F\) gets us back to the size of \(t\) (but not its sign).

Did you notice something familiar about \(MS_{\text{within}}\)? We’ve already done this in the past. We just knew it by another name: pooled variance. We add the two groups’ sums of squares and divide by their combined degrees of freedom: \((3{,}488 + 5{,}262) / (3 + 3) = 1{,}458.3\). The \(t\) statistic turns that pooled variance into a standard error in the original units, to match the difference between means in its numerator. ANOVA leaves it squared. Likewise, with two groups, its numerator, \(MS_{\text{between}}\), captures the same difference between means as \(t\)’s numerator, but squared and scaled by the group sizes to give the mean square.

This squared correspondence also helps explain the shape of the \(F\) distribution we saw in step 1 of Activity 14.4. Since for two independent groups, \(F = t^2\), the whole \(F\) distribution is literally the corresponding \(t\) distribution squared. As a result, negative \(t\) values become positive \(F\) values, and large values get pushed farther out. Activity 14.5 shows the transformation.

Activity 14.5: Squaring t into F
The null t distribution with 6 degrees of freedom is squared in two steps. First the sign is dropped: the negative half turns over onto the positive half, so −2 lands on 2 and the two 2.5% tails lie together beyond ±2.447. Then each value is squared: ±1 stays at 1, ±2 moves to 4 and ±3 to 9. The result is the F distribution with 1 and 6 degrees of freedom, with the critical value 2.447 now at 5.99, still cutting off 5%.

Here’s the null \(t\) distribution with 6 degrees of freedom. For our two-tailed test with \(\alpha = .05\), each tail contains 2.5%, beyond the critical values of \(\pm 2.447\).

Squaring does two things at the same time, but we’ll show them separately here. First, it drops the sign: \((-2)^2\) and \(2^2\) are both 4. To show that visually, we fold the negative half onto the positive half. The dashed line shows the positive part of the original \(t\) curve; the fold has doubled it. The two 2.5% tails got combined, so the region beyond 2.447 now holds 5% of the distribution.

Second, we square each value. \(t = 2\) becomes \(F = 4\), \(t = 3\) becomes \(F = 9\), and so on. Values of exactly 1 are unchanged, while values between 0 and 1 move closer to zero. The result is \(F(1, 6)\), with the critical value now at \(2.447^2 \approx 5.99\). The tail beyond it still contains the same 5%.

So for our spider data, the two-tailed \(t\) test and the ANOVA give the same \(p = .020\). Both tails of \(t\) become the single right tail of \(F\).

Figure 14.1: The same data analyzed two ways: \(t \approx -3.15\) and \(F \approx 9.91\). The shaded areas give the same \(p\) value.
Null t distribution with 6 degrees of freedom. The observed t of −3.15 is marked, and p = .020 is shaded: .010 beyond −3.15 and .010 beyond +3.15.
F distribution with 1 and 6 degrees of freedom. The observed F of 9.91 is marked, and p = .020 is shaded in the single tail beyond it.

Learning Checks: From t to F

0 of 5
1

Suppose we add 20 ms to every score in the ordinary-bite group, leaving the radioactive-bite scores alone. Which sum of squares must stay the same?

Response options

\(SS_{\text{total}}\)

\(SS_{\text{between}}\)

\(SS_{\text{within}}\)

Answer

\(SS_{\text{within}}\)

Explanation

Every ordinary-bite score and its group mean move together, so the deviations within that group don’t change. Neither do those in the other group. The group means move farther apart, increasing the between-groups and total sums of squares.

2

Another study has two independent groups of five people. \(SS_{\text{between}} = 180\) and \(SS_{\text{within}} = 240\). Calculate \(F\).

Hint

Find each component’s degrees of freedom before comparing the mean squares.

Answer

6

Explanation

\(N = 10\) and \(k = 2\), so \(df_{\text{between}} = 1\) and \(df_{\text{within}} = 8\). The mean squares are \(180/1 = 180\) and \(240/8 = 30\), giving \(F = 180/30 = 6\). Dividing the sums directly would give \(0.75\), comparing quantities that haven’t been adjusted for their different degrees of freedom.

Check your work

What is the between-groups df?

Answer

1

Explanation

\(k - 1 = 2 - 1 = 1\).

What is the within-groups df?

Answer

8

Explanation

\(N - k = 10 - 2 = 8\).

What is the within-groups mean square?

Answer

30

Explanation

\(SS_{\text{within}}/df_{\text{within}} = 240/8 = 30\).

3

Under the null hypothesis, both mean squares estimate the same population variance. What does that imply about repeated samples?

Response options

Every sample gives \(F = 1\).

The mean of the F values must be exactly 1.

The F values vary, following the null distribution for their df.

Answer

The F values vary, following the null distribution for their df.

Explanation

Estimating the same variance doesn’t make the estimates equal in every sample, or make their ratio average 1. For example, the \(F(1, 6)\) distribution has a mean of 1.5.

4

A pooled independent-samples \(t\) test gives \(t(8) = -2.50\). For the same data and assumptions, what would the two-group ANOVA’s \(F\) and its two degrees of freedom be? Would its p-value match the one-tailed or the two-tailed t test? What information does F lose?

Answer

\(F(1, 8) = (-2.50)^2 = 6.25\). Its p-value matches the two-tailed \(t\) test: both tails of \(t\) become the right tail of \(F\). Squaring loses the sign, so \(F\) doesn’t say which mean is higher.

5

Two groups have exactly the same sample mean, but scores vary within each group. What is F?

Response options

0

1

It can’t be calculated.

Answer

0

Explanation

The between-groups sum of squares and mean square are zero. Dividing zero by a positive within-groups mean square gives \(F = 0\). The scores within each group needn’t be identical, and identical sample means don’t prove identical population means.

Comparing more than two groups

So we’ve compared the same two groups in two ways, and reached the same answer. Now let’s see what ANOVA lets us do that a single \(t\) test can’t: compare more than two groups.

Suppose we’re still interested in the effects of spider bites, but we’ve had another realization. Our two-group comparison might have established a difference between the group bitten by a radioactive spider and the group bitten by an ordinary spider, but what does that mean? Perhaps the radioactive bite makes people faster, or maybe the ordinary bite slows them down, or both! Or maybe both bites speed up reactions, but the radioactive bite more so than the ordinary bite. How can we tell what’s really going on?

With just two groups, we can’t. But there is a simple solution. We’ll include a third group in the comparison: a control condition, where kids take the test without having been bitten at all. This will offer a baseline against which we can compare both treatment groups, looking for an increase or decrease in average performance. (We’ll randomly assign our participants to the three conditions, so preexisting differences among the kids aren’t systematically tied to bite type.)

So take a look at this little dataset and the group means. Just from eyeballing it, does it look like the radioactive bite sped kids up? How about the ordinary bite?

Table 14.4: Reaction times (ms) for the three spider-bite conditions.
🕷️ Radioactive bite 🕷️ Ordinary bite 😐 No bite
\(189\) \(310\) \(265\)
\(161\) \(219\) \(252\)
\(237\) \(303\) \(298\)
\(169\) \(264\) \(321\)
\(M = 189\) \(M = 274\) \(M = 284\)

You probably noticed that the radioactive-bite group was way faster than the no-bite group, on average, and faster than the ordinary-bite group too. The ordinary-bite group was a little faster than no bite, but not by much.

So how much of a difference is enough? The independent-samples \(t\) test starts by subtracting one mean from another. But we can’t just do 189 minus 274 minus 284 here. That wouldn’t make any sense. How can we consider differences among all the groups at once? The \(t\) test can’t do the job, but analysis of variance can.

Perhaps you also noticed the variability in the data in general. The individual scores overlap quite a bit, especially the ordinary-bite and no-bite groups; not so much the radioactive-bite group. Talking through the patterns of variability like this, we’re essentially doing an informal ANOVA, comparing variances within groups and between groups.

More formally, our question is still about means, but we can quantify how far all three means fall from the grand mean, just as we did with two. The between-groups variance captures those differences, and the within-groups variance gives us a comparison based on how much scores vary even among people receiving the same treatment. So we can form the same \(F\) ratio as before. We never needed to subtract one group mean from another, so adding a third group doesn’t change the logic.

(You might wonder why we can’t just run three \(t\) tests one after another instead. There’s a good reason, which we’ll come back to when we get to post-hoc tests.)

ANOVA terminology

There’s some new terminology that comes with ANOVA. The factor refers to the independent variable that designates the groups being compared. For our little example study here, we might label the factor type of spider bite, or bite type for short.

The levels are the individual treatments that make up a factor. So here we have three levels of our bite type factor: the radioactive bite treatment, the ordinary bite treatment, and the control—no bite—treatment.

So our study calls for a single-factor, independent-samples ANOVA: one factor with three levels, and independent groups at each level. (You’ll also sometimes see this called a one-way ANOVA.) ANOVA can accommodate any number of levels and factors. For example, we’ll introduce two-by-two designs in Chapter 16, where we’ll have two factors with two levels each. But for this chapter we’ll stick to a single factor.

Three groups, the same logic

Before we work through the formal hypothesis test, Activity 14.6 previews visually what the math will do with three groups.

Activity 14.6: Adding a third group
Three groups of reaction times are used to build total, within-groups, and between-groups sums of squared deviations. The total partitions into within plus between. Dividing each component by its degrees of freedom gives the mean squares, whose ratio is F.

The no-bite group joins the two groups from before. We now have 12 scores in three groups. We’ll use the same procedure to see how it accommodates that third group.

We start with the grand mean, at \(249\) ms for all 12 scores together. Each score’s deviation from that grand mean is drawn, squared, and poured into the total sum of squares.

Next we can see the within-groups sum of squares as a proportion of the total. Each score’s deviation from its own group mean is drawn, squared, and poured into the within-groups total.

Now back to the grand mean, but instead of looking at each score’s deviation, we just look at how far each group mean is from that grand mean. We square those three deviations, and count each square four times, because each group mean represents four scores.

Note that the group-mean deviations aren’t mirror images like they were with just two groups, but they still balance: the deviations sum to zero. Once two are known, the third is determined, leaving two degrees of freedom.

Now we have the total sum of squared deviations partitioned exactly into between plus within. Adding another group didn’t require us to change the fundamental approach at all.

As before, we separate the two sums of squares. To compare them, we need to divide each by its own degrees of freedom.

With three groups, \(df_{\text{between}} = k - 1 = 2\). So we divide the between-groups square into two equal pieces. One piece is the mean square, \(MS_{\text{between}}\).

Within each group, one deviation is determined by the other three. Across three groups, that leaves \(df_{\text{within}} = N - k = 9\). We divide the within-groups square into nine equal pieces; one piece is \(MS_{\text{within}}\).

Finally, we compare the mean squares. The numerator looks quite a bit bigger than the denominator here; \(F\) should be quite large. To formally judge it we’ll need to compute the precise numbers and compare the answer against the null \(F\) distribution with 2 and 9 degrees of freedom.

Hypothesis testing with ANOVA

So let’s work through a hypothesis test for our bite type / reaction time example.

Step 1: State the hypotheses

As usual, we state our hypotheses first. The null here is that all three population means are the same:

\[ H_0: \mu_{\text{radioactive}} = \mu_{\text{ordinary}} = \mu_{\text{no bite}} \]

\(H_1\): At least one population mean differs from another. That doesn’t mean they all differ from one another, necessarily. We’re just saying that there is some difference among the conditions somewhere.

If the null is true, both mean squares estimate the same population variance, as we saw in Activity 14.3. Their ratio can still vary considerably from sample to sample; Activity 14.4 showed us how the degrees of freedom affect that variation. A treatment effect contributes to the between-groups mean square without increasing the within-groups mean square, so it tends to make \(F\) larger. We test whether our observed \(F\) is unusually large compared with the null distribution.

Step 2: Set the decision criteria

We’ll use \(\alpha = .05\). With \(k = 3\) groups and \(N = 12\) scores, the numerator has \(df_{\text{between}} = k - 1 = 2\), and the denominator has \(df_{\text{within}} = N - k = 9\). In Table 14.5, the column for 2 and the row for 9 give a critical \(F\) of 4.26. We’ll reject the null if our \(F\) exceeds that value.

The rejection region is in the right tail, but the hypothesis is still about any difference among the means, in any direction. As we saw when squaring \(t\), a large \(F\) doesn’t tell us which group has the higher mean.

Table 14.5: An excerpt of the \(F\) table, with the critical value for \(df = 2\) and \(9\) highlighted.
F table excerpt for numerator df 1 through 4 and denominator df 7 through 11, highlighting the .05 critical value of 4.26 at F(2, 9).

Step 3: Collect and analyze the data

Now we’re ready to calculate the test statistic, the \(F\) ratio. With so many parts to keep track of along the way, it can be useful to organize the answers in a summary table, with rows for the components of variability and columns for the different quantities. Table 14.6 shows the equations for each element, which we’ll fill in with the answers once we have computed them.

Table 14.6: An ANOVA summary table, showing each equation.
Source \(SS\) \(df\) \(MS\) \(F\)
Between groups \(\Sigma n_{\text{group}}(M_{\text{group}} - M_{\text{grand}})^2\) \(k - 1\) \(\dfrac{SS_{\text{between}}}{df_{\text{between}}}\) \(\dfrac{MS_{\text{between}}}{MS_{\text{within}}}\)
Within groups \(\Sigma (X - M_{\text{group}})^2\) \(N - k\) \(\dfrac{SS_{\text{within}}}{df_{\text{within}}}\)
Total \(\Sigma (X - M_{\text{grand}})^2\) \(N - 1\)

Now, time for some sums. This is the arithmetic behind Activity 14.6. For our spider-bite data, the ingredients are: \(N = 12\) scores in total, \(n_{\text{group}} = 4\) per condition, and \(k = 3\) conditions. The group means are 189, 274, and 284 ms, and the grand mean is 249 ms.

Just as we did in Chapter 4, we can lay out each squared deviation in a table before adding them up. Table 14.7 uses the grand mean for the total column, each score’s own group mean for the within-groups column, and the group mean minus the grand mean for the between-groups column.

Table 14.7: Squared deviations and their sums for the three spider-bite conditions.
Condition Score, \(X\) Total: \((X-M_{\text{grand}})^2\) Within: \((X-M_{\text{group}})^2\) Between: \((M_{\text{group}}-M_{\text{grand}})^2\)
Radioactive bite \(189\) \((189-249)^2=3{,}600\) \((189-189)^2=0\) \((189-249)^2=3{,}600\)
\(161\) \((161-249)^2=7{,}744\) \((161-189)^2=784\) \((189-249)^2=3{,}600\)
\(237\) \((237-249)^2=144\) \((237-189)^2=2{,}304\) \((189-249)^2=3{,}600\)
\(169\) \((169-249)^2=6{,}400\) \((169-189)^2=400\) \((189-249)^2=3{,}600\)
\(M_{\text{radioactive}}=189\)
Ordinary bite \(310\) \((310-249)^2=3{,}721\) \((310-274)^2=1{,}296\) \((274-249)^2=625\)
\(219\) \((219-249)^2=900\) \((219-274)^2=3{,}025\) \((274-249)^2=625\)
\(303\) \((303-249)^2=2{,}916\) \((303-274)^2=841\) \((274-249)^2=625\)
\(264\) \((264-249)^2=225\) \((264-274)^2=100\) \((274-249)^2=625\)
\(M_{\text{ordinary}}=274\)
No bite \(265\) \((265-249)^2=256\) \((265-284)^2=361\) \((284-249)^2=1{,}225\)
\(252\) \((252-249)^2=9\) \((252-284)^2=1{,}024\) \((284-249)^2=1{,}225\)
\(298\) \((298-249)^2=2{,}401\) \((298-284)^2=196\) \((284-249)^2=1{,}225\)
\(321\) \((321-249)^2=5{,}184\) \((321-284)^2=1{,}369\) \((284-249)^2=1{,}225\)
\(M_{\text{no bite}}=284\)
Sum of squares \(SS_{\text{total}}=33{,}500\) \(SS_{\text{within}}=11{,}700\) \(SS_{\text{between}}=21{,}800\)

The between-groups calculation repeats once for each score in the group. With four scores per group, each group-mean squared deviation appears four times; this is why the compact formula multiplies each one by \(n_{\text{group}}\). The column sums satisfy \(SS_{\text{total}} = SS_{\text{within}} + SS_{\text{between}}\), although the individual rows generally do not.

Adding the squared deviations gives us:

\[ \begin{align} SS_{\text{total}} &= \Sigma (X - M_{\text{grand}})^2 = 33{,}500 \\ SS_{\text{within}} &= \Sigma (X - M_{\text{group}})^2 \\ &= 3{,}488 + 5{,}262 + 2{,}950 = 11{,}700 \\ SS_{\text{between}} &= \Sigma n_{\text{group}}(M_{\text{group}} - M_{\text{grand}})^2 \\ &= 4(-60)^2 + 4(25)^2 + 4(35)^2 = 21{,}800 \end{align} \]

\[ \begin{align} df_{\text{total}} &= N - 1 = 12 - 1 = 11 \\ df_{\text{within}} &= N - k = 12 - 3 = 9 \\ df_{\text{between}} &= k - 1 = 3 - 1 = 2 \end{align} \]

\[ \begin{align} MS_{\text{between}} &= \frac{SS_{\text{between}}}{df_{\text{between}}} = \frac{21{,}800}{2} = 10{,}900 \\ MS_{\text{within}} &= \frac{SS_{\text{within}}}{df_{\text{within}}} = \frac{11{,}700}{9} = 1{,}300 \end{align} \]

\[ F = \frac{MS_{\text{between}}}{MS_{\text{within}}} = \frac{10{,}900}{1{,}300} \approx 8.38 \]

And here’s the completed summary table:

Table 14.8: Completed ANOVA summary table for the spider-bite example.
Source \(SS\) \(df\) \(MS\) \(F\)
Between groups \(21{,}800\) \(2\) \(10{,}900\) \(8.38\)
Within groups \(11{,}700\) \(9\) \(1{,}300\)
Total \(33{,}500\) \(11\)

Step 4: Make a decision

As usual, step four is to make our decision. Our \(F = 8.38\) exceeds the critical value of 4.26, so we reject the null hypothesis. The corresponding \(p\)-value is about \(.009\). That gives us evidence of a difference among the population means somewhere.

Figure 14.2: The observed \(F = 8.38\) falls beyond the critical value of the null \(F\) distribution with \(df = 2\) and \(9\).
Null F distribution with 2 and 9 degrees of freedom. The rejection region lies above 4.26; the observed F of 8.38 is in the rejection region.

Step 5: Estimate the effect, compare the groups, and consider power

Effect size: \(\eta^2\)

As in previous chapters, we want to estimate the effect size whether or not the test is significant. For ANOVA, our measure of effect size is called eta squared (\(\eta^2\)). This reflects the proportion of the total variability accounted for by differences between the groups.

We find \(\eta^2\) by dividing \(SS_{\text{between}}\) by \(SS_{\text{total}}\).

\[\eta^2 = \frac{SS_{\text{between}}}{SS_{\text{total}}} \]

But didn’t I say earlier that we can’t compare sums of squares, that we needed to compare mean squares instead? Well, that was necessary for the \(F\) ratio. We divided each sum by its own degrees of freedom to adjust for the fact that those variance estimates were made up of different numbers of deviations, producing mean squares that we could fairly compare with one another in the \(F\) ratio.

For \(\eta^2\), though, we don’t need a fair comparison in the same sense. Like Cohen’s \(d\), \(\eta^2\) describes the size of the differences relative to the spread of the scores, rather than how precisely we’ve estimated them. So \(\eta^2\) answers a simpler question than \(F\): of all the variability in the data, what share is due to differences between the groups? \(SS_{\text{total}}\) gives us the whole, and \(SS_{\text{between}}\) gives us a part.

So for the spider data:

\[\eta^2 = \frac{SS_{\text{between}}}{SS_{\text{total}}} = \frac{21{,}800}{33{,}500} = .65\]

So about 65% of the total variability in these scores is between the groups. We saw a visual representation of this already, with the partitioned \(SS_{\text{total}}\) square in Activity 14.6: \(\eta^2\) is the share occupied by the between-groups component.

Post-hoc tests

Now that we have a significant result, maybe you’re not quite satisfied yet. After all, we’ve established that at least one of our conditions is different from at least one other. But which conditions differ?

That’s the limitation of an omnibus test, which is what ANOVA is: it tests the means together, telling us whether there is evidence of any difference among them. It doesn’t tell us which means differ, which is obviously something we’d want to know. So we’ll follow our significant ANOVA with post-hoc tests, additional tests comparing two group means at a time. These are called pairwise comparisons.

Maybe you’re thinking, “Why do we go through this whole song and dance just to end up doing pairwise comparisons again, like we did with the \(t\) test? Why couldn’t we just start with the \(t\) tests?” The problem is the number of tests. With three groups, there are three comparisons to make: A to B, A to C, and B to C. Each ordinary \(t\) test at \(\alpha = .05\) has its own 5% Type I error rate. Across all three tests, the chance of making at least one Type I error is greater than 5%: about 14% if the tests were independent (\(1 - .95^3\)). This is the experiment-wise error rate.

The initial omnibus ANOVA performs one overall test at \(\alpha = .05\). For our follow-up comparisons, we use tests designed to control the error rate across the pairwise comparisons.

There’s more than one kind of post-hoc test you can do, but we’ll just mention one. It’s called Tukey’s Honestly Significant Difference (HSD) test, which is a great name for a test. It gives us a minimum difference between group means that counts as significant, while controlling the experiment-wise error rate at our chosen alpha.

Even when the population means are identical, the sample means will usually differ a bit due to sampling error. With more groups, there are more opportunities for a large chance difference. Tukey’s cutoff takes that into account when judging all the pairwise comparisons together.

The equation to find the honestly significant difference is:

\[ HSD = q \cdot \sqrt{MS_{\text{within}} / n} \]

In this equation, \(q\) is the studentized range statistic, which is based on the gap between the highest and lowest means relative to chance variability. There are tables to look up its critical values, like the one in Table 14.9. Across the top is the number of conditions in your study, and the rows are possible degrees of freedom for the denominator of the \(F\) ratio.

Table 14.9: Critical values of the studentized range statistic \(q\) for \(\alpha = .05\), by number of conditions (columns) and \(df\) for the denominator (rows).
Studentized range critical values at alpha .05 for 2 through 6 conditions and error df 4 through 10. The highlighted cell for 3 conditions and 9 error degrees of freedom is q = 3.95.

The other pieces of the equation should look familiar. \(n\) is the number of scores in each condition (this version assumes equally sized groups). \(MS_{\text{within}}\) is our pooled estimate of the background variability, using all the groups. Dividing by \(n\) and taking the square root puts it on the scale of variability among sample means. More variability makes the required difference larger; more people per group make the means more precise. The critical \(q\) accounts for how many means we’re comparing and the degrees of freedom of our variance estimate.

So for our little dataset, there are three conditions and the degrees of freedom for the denominator were nine, so our \(q\) value is 3.95.

\[HSD = q \sqrt{\frac{MS_{\text{within}}}{n}} = 3.95 \sqrt{\frac{1{,}300}{4}} = 71.2\]

That answer tells us that an absolute difference between group means of more than 71.2 ms is statistically significant. Here’s how our three comparisons work out:

Comparison Absolute difference Exceeds 71.2 ms?
Radioactive bite vs. ordinary bite 85 ms Yes
Radioactive bite vs. no bite 95 ms Yes
Ordinary bite vs. no bite 10 ms No

So looking back at the condition means, we can now say that the kids given a radioactive bite were significantly faster than the kids given an ordinary bite, and significantly faster than the control group. But the ordinary-bite group did not differ significantly from the control condition.

Statistical power

The logic of statistical power is the same as in previous chapters. If there really are differences among the population means, how often would our test detect them? Let’s see what happens to the sampling distribution when the null is false.

Activity 14.7: When the means really differ
Three groups of four reaction times are sampled first with equal population means, then with hypothetical population means of 210, 230, and 250 ms. With a real difference, the between-groups mean square tends to increase while the within-groups mean square is unchanged. Repeated sampling estimates power as the proportion of F values above the null critical value of 4.26. Increasing the sample size to 17 per group raises estimated power to about 80%, with a null critical value of 3.19.

Here are three groups of four kids, sampled from populations with exactly the same mean and standard deviation. Both mean squares estimate the population variance. This is the null situation we’ve already explored; any differences among the sample means are just sampling error. The distribution of \(F\) ratios obtained from 200 simulated samples is shown in the histogram. It follows the null \(F\) distribution with 2 and 9 degrees of freedom, and only a few of the samples fall beyond the critical value of 4.26, which is where we would reject the null. Those red bars are Type I errors; in the long run, they make up 5% of samples.

But what if the null is false, actually? Here I’ve created hypothetical population means of 210, 230, and 250 ms. The within-groups mean square stays the same size, because the variability within each group is unchanged, but the between-groups mean square now reflects a real difference as well as sampling error. For our first sample, \(F = 6.03\), which exceeds the critical value of 4.26, so we would reject the null.

Now we repeat the study 200 times with those same population differences. The histogram now represents sampling under a real effect, with the null curve staying for comparison (we still reject whenever \(F > 4.26\)). In this set of 200 samples, around 23% reject the null (the purple bars). That estimates the power of the overall ANOVA for these population differences and sample sizes: the long-run proportion of studies that would detect some difference among the means. The rest (the gray bars) miss a real effect, making Type II errors.

If we wanted to bring our power up to, say, .80, we could increase the number of participants per group. Here I’ve increased it to 17 per group, which gives us an estimated power of about 80%. The null curve narrows slightly and the critical value drops to 3.19 because of the changed \(df_{\text{within}}\).

Statistical software can calculate power for ANOVA, or work backwards to find the sample size needed for a target such as 80% power. As before, we need to specify differences worth detecting, estimate the variability within groups, and choose an alpha level. More participants per group generally give us more power. As in previous chapters, this is a tool for planning a future study, rather than plugging our observed means back in to calculate “observed power.”

Reporting and interpreting results

As usual, we report the descriptive statistics—the group means and standard deviations—along with the kind of test, the \(F\) statistic with its degrees of freedom, the \(p\)-value, and the effect size \(\eta^2\). Here we also report the follow-up comparisons, since they tell us which groups differed.

A single-factor, independent-samples ANOVA revealed a significant difference among kids who received a radioactive spider bite (\(M = 189\), \(SD = 34.10\) ms), an ordinary spider bite (\(M = 274\), \(SD = 41.88\) ms), and the control condition (\(M = 284\), \(SD = 31.36\) ms); \(F(2, 9) = 8.38\), \(p = .009\), \(\eta^2 = .65\). Tukey HSD comparisons indicated that the radioactive-bite group was faster than both other groups; the ordinary-bite and control groups did not differ significantly.

We could also show the group means in a graph like Figure 14.3.

Figure 14.3: A bar graph showing average reaction times in the three bite conditions. Error bars are 95% confidence intervals. Note that these CIs are not adjusted for multiple comparisons; their overlap is often used as a rough guide to whether a pairwise comparison is significant, but it is not a substitute for the Tukey tests reported above.
Bar graph of mean reaction times: radioactive bite 189 ms, ordinary bite 274 ms, and no bite 284 ms. The 95% confidence intervals are approximately 148–230, 233–315, and 243–325 ms, respectively.

This is a common way of showing group means and their uncertainty. But it’s not the only way we could visualize this kind of data. Like we pointed out in Chapter 2, every graph involves choices. These bars emphasize the aggregate; they don’t show the individual scores, so we can’t see their distribution or how many observations went into each average and its uncertainty. We should always ask what a graph helps us see, and what it leaves out.

In any case, what do these results mean? What would they tell us about the world that we didn’t know before? Remember why we added the no-bite group. A comparison of radioactive and ordinary bites alone couldn’t tell us whether one sped kids up or the other slowed them down. The baseline comparison now permits us to conclude that the radioactive bite sped them up. There was no apparent difference between no bite and a bite from an ordinary spider; only the radioactive bite made a difference.

As usual, we ought to be cautious in our interpretation, though. A nonsignificant difference isn’t proof of no effect. With only four kids per group, the statistical uncertainty can easily obscure smaller differences.

And a significant result isn’t proof that a difference exists or that it was caused by our manipulation. The random-assignment design supports interpreting differences as effects of bite type, though we should be careful that we didn’t accidentally create some other difference; perhaps it’s not radioactivity that makes people react faster but the anxiety induced by the researcher’s maniacal laughter as they administered that particular kind of bite. (I was picturing Doc Ock as the experimenter, weren’t you?)

Assumptions

Finally, it’s worth spelling out the conditions and assumptions for ANOVA to be an appropriate analysis. Design-wise, the thing that is measured and compared needs to be a quantitative variable (same as the \(z\) and \(t\) tests). Here that’s reaction time. The factor, bite type, is categorical. This design allows us to compare scores across conditions.

ANOVA also shares the independent-samples \(t\) test’s underlying assumptions: observations are independent (both within and between groups); the populations which produced our samples are approximately normal; and their variances are equal (the homogeneity of variance assumption).2

Learning Checks: Using ANOVA

0 of 7
1

A researcher randomly assigns 18 people to study in silence, with music, or with conversation in the background, then gives each person one memory test. Identify the factor and its levels, and state the null and alternative hypotheses for a single-factor ANOVA.

Answer

The factor is background sound, with three levels: silence, music, and conversation. \(H_0: \mu_{\text{silence}} = \mu_{\text{music}} = \mu_{\text{conversation}}\). \(H_1\): At least one population mean differs from another; it doesn’t require all three to differ. The groups are independent because each person contributes a score in just one condition and there are no matched pairs.

2

For that study, \(SS_{\text{total}} = 240\) and \(SS_{\text{within}} = 150\). Calculate F.

Hint 1

Find the between-groups sum of squares using the partition of the total.

Hint 2

Use \(k = 3\) and \(N = 18\) to find the two degrees of freedom.

Answer

4.5

Explanation

\(SS_{\text{between}} = 240 - 150 = 90\). \(df_{\text{between}} = 2\) and \(df_{\text{within}} = 15\), giving \(MS_{\text{between}} = 45\) and \(MS_{\text{within}} = 10\). So \(F(2, 15) = 45/10 = 4.50\).

Check your work

What is the between-groups sum of squares?

Answer

90

Explanation

\(240 - 150 = 90\).

What is the between-groups mean square?

Answer

45

Explanation

\(90/(3 - 1) = 45\).

What is the within-groups mean square?

Answer

10

Explanation

\(150/(18 - 3) = 10\).

3

Continue with the memory study. The critical value is 3.68 at \(\alpha = .05\). What decision would you make? Calculate and interpret eta squared. Do these results identify which sound conditions differ?

Answer

\(F = 4.50\) exceeds 3.68, so we reject the null hypothesis. \(\eta^2 = 90/240 = .375\): 37.5% of the variability in these sample scores is between groups. This is a sample estimate, not the percentage of people affected or a known population proportion. Neither F nor eta squared identifies which pairs differ.

4

Why use Tukey’s adjustment for the three pairwise comparisons, rather than three ordinary t tests at \(\alpha = .05\)?

Response options

To control the chance of at least one Type I error across the comparisons.

To make each pairwise comparison more likely to be significant.

To prevent Type II errors across the comparisons.

Answer

To control the chance of at least one Type I error across the comparisons.

Explanation

Testing each pair at .05 makes the chance of at least one false positive across the comparisons greater than .05. Tukey’s method controls that combined error rate. Running ANOVA first isn’t itself the adjustment, and the protection doesn’t eliminate errors.

5

Return to our spider-bite study. Tukey’s threshold was 71.2 ms. The radioactive-bite mean was 95 ms below the no-bite mean; the ordinary-bite mean was 10 ms below it. Which baseline comparisons are significant? Does this establish that ordinary bites have no effect? What supports a causal interpretation?

Answer

Radioactive versus no bite is significant because 95 exceeds 71.2; ordinary versus no bite is not because 10 doesn’t. We have evidence that radioactive bites sped reaction times relative to no bite, but haven’t proved ordinary bites have no effect. Four people per group could miss smaller differences. Random assignment supports the causal interpretation; the ANOVA alone doesn’t establish it.

6

In the power tutorial, all 200 studies sampled populations with genuinely different means, but only about 23% rejected the null. What happened in the other studies? For a future study, what would you specify to plan for 80% power?

Answer

The other studies made Type II errors: they missed a real difference. The 23% is a simulation estimate of power, not the probability that the null is false. To plan the next study, we’d specify the number of groups, differences worth detecting, within-groups variability, alpha, and target power, then use software to find the sample size per group. We wouldn’t plug in the observed means merely to calculate observed power.

7

Which study fits the independent-samples ANOVA developed here? The outcome is a quantitative memory score. Assume the population scores in each condition are approximately normal with equal variances.

Response options

Different, unrelated people each take one test in one of three conditions.

The same people each take a test in all three conditions.

People are matched into trios, with one person per condition.

Answer

Different, unrelated people each take one test in one of three conditions.

Explanation

This chapter’s version assumes independent observations. Repeated measurements or matching link the scores, so we need an analysis that accounts for those links. Normality concerns scores within each population; homogeneity concerns the population variances, not whether the observed sample variances match exactly.

Fisher, R. A. (1918). The correlation between relatives on the supposition of mendelian inheritance. Transactions of the Royal Society of Edinburgh, 52, 399–433. https://doi.org/10.1017/S0080456800012163
Snedecor, G. W. (1934). Calculation and interpretation of analysis of variance and covariance. Collegiate Press.
Student. (1923). On testing varieties of cereals. Biometrika, 15(3–4), 271–293. https://doi.org/10.1093/biomet/15.3-4.271

  1. As with the sum of squares back in Chapter 4, there are also computational versions of these formulas. You might see them elsewhere, since they were the standard approach when researchers had to compute things by hand. Remember, the main difference in the computational formula for basic \(SS\) was that it involved summing scores (\(\Sigma X\)) and summing squared scores (\(\Sigma X^2\)). The ANOVA versions do something very similar, but in a few different ways. They use two new symbols: \(T\), a treatment total (the sum of the scores in one condition), and \(G\), the grand total (the sum of all the scores in the study).

    \[ \begin{align} SS_{\text{total}} &= \Sigma X^2 - \frac{G^2}{N} \\ SS_{\text{within}} &= \Sigma X^2 - \Sigma \frac{T^2}{n_{\text{group}}} \\ SS_{\text{between}} &= \Sigma \frac{T^2}{n_{\text{group}}} - \frac{G^2}{N} \end{align} \]

    As in Chapter 4, we’ll stick with the definitional formulas, which are a bit more intuitive.↩︎

  2. Just as there is a Welch version of the independent-samples \(t\) test, there is a Welch ANOVA that doesn’t assume equal population variances.↩︎

13  Related-samples \(t\) test
15  Related-samples ANOVA