MathsStatistics & Probability

ANOVA
calculator.

One-way analysis of variance tests whether several group means could really be equal.

How it's worked out

You have one factor, such as a temperature setting or a teaching method, and independent measurements at each level of it. The hypothesis under test says the population means are all the same. The alternative says they are not. The method splits the spread of your values into a part between the groups and a part inside them.

SST\displaystyle \text{SST}=SSB+SSW\displaystyle {}=\;\text{SSB} + \text{SSW}
SSB\displaystyle \text{SSB}=∑ni(x‾i−x‾)2\displaystyle {}= \sum n_i (\bar{x}_i - \bar{x})^2
SSW\displaystyle \text{SSW}=∑i∑j(xij−x‾i)2\displaystyle {}= \sum_i \sum_j (x_{ij} - \bar{x}_i)^2

Here nin_i and x‾i\bar{x}_i are the size and mean of group ii, x‾\bar{x} is the mean of every value, and xijx_{ij} is one value. Each sum of squares is then divided by its degrees of freedom, which gives a mean square. With kk groups and NN values, the two mean squares and their ratio are:

MSB\displaystyle \text{MSB}=SSBk−1\displaystyle {}= \frac{\text{SSB}}{k - 1}
MSW\displaystyle \text{MSW}=SSWN−k\displaystyle {}= \frac{\text{SSW}}{N - k}
F\displaystyle F=MSBMSW\displaystyle {}= \frac{\text{MSB}}{\text{MSW}}

MSW measures the noise inside the groups, whether or not the means differ. MSB measures that same noise only when the means are equal, and real differences push it up. So F sits near 1 when nothing is going on. The p-value is the area of the F curve to the right of your F, on k−1k - 1 and N−kN - k degrees of freedom.

The effect sizes

Eta squared is the share of the total sum of squares that the groups explain in your sample. Omega squared takes off what chance alone would produce, so it is a less biased guide to the population. That published form of omega squared assumes equal group sizes, so treat it as approximate when yours differ.

η2\displaystyle \eta^2=SSBSST\displaystyle {}= \frac{\text{SSB}}{\text{SST}}
ω2\displaystyle \omega^2=SSB−(k−1)MSWSST+MSW\displaystyle {}= \frac{\text{SSB} - (k - 1)\,\text{MSW}}{\text{SST} + \text{MSW}}

Worked examples

Resistors tested at three temperatures

This is the example in NIST's handbook: five resistors at each of three temperature levels. The group means are 5.34, 7.72, 8.56, and the mean of all 15 values is 7.2067.

The sums of squares are 27.897 between and 17.452 within. That gives mean squares of 13.949 on 2 degrees of freedom and 1.454 on 12, so F is 9.59. The critical value at 0.05 is 3.89, and p is 0.0032, so you reject equal means.

Eta squared is 0.615, so temperature accounts for about 62% of the variation. The pairs show where the difference lies. Level 1 differs from level 2 (adjusted p 0.0265) and level 3 (adjusted p 0.0036), but levels 2 and 3 do not clearly differ from each other (adjusted p 0.8771).

Open this example in the tool

Etch rate at four plasma power settings

An engineer measures etch rate in angstroms per minute, five wafers at each of 160, 180, 200 and 220 W. The group means climb from 551.2 to 707. F on 3 and 16 degrees of freedom is 66.8, and p is below 0.0001.

Eta squared of 0.926 says power setting explains almost all of the variation. All 6 pairs differ after the Bonferroni adjustment, which is what you would expect when the means are this far apart and the groups this tight.

Open this example in the tool

Daily sales at three similar stores

Three stores log six days of sales each. The means are 12.83, 13, 12.83, and F is 0.026 with p of 0.9741. The between mean square is smaller than the within one, which is quite possible when the means are equal.

This does not prove the stores sell the same amount. It says these 18 readings cannot tell them apart. Keep the same means and spreads with five times the data, and p is still 0.8769, because these means hardly differ at all.

Open this example in the tool

Reading your result

Start with F and p. An F below the critical value means the means vary about as much as chance alone would make them. A p below your level means a gap this large would be rare if all the means were equal. It does not tell you how big the gap is.

Then read the effect size. Cohen's benchmarks for eta squared are 0.01 small, 0.06 medium and 0.14 large. Lakens, who quotes them, suggests using them only as a last resort, since they were built for comparisons between unrestricted populations. With a lot of data, even a tiny gap can be significant, so read both figures together.

Use the pairs to find the difference. Each pair gets a t statistic built on the pooled MSW and N−kN - k degrees of freedom, and its p-value is multiplied by the number of pairs. That is the Bonferroni method. NIST notes that Tukey has the edge when you want every pair, and that Bonferroni may do better when you want only a few.

Look at Welch's line when spreads differ. The classic test assumes equal variances. Delacre and colleagues found that when this fails, the classic F can be too strict or too lenient, depending on how group sizes pair with spreads, and that with more than two groups it turns lenient even at equal sizes. Welch's test held up better, so it is the one to trust when the standard deviations clearly differ.

Under the model, errors are independent and normal with one shared variance. Each group needs at least two values. If every group has no spread at all but the means differ, F has no upper limit, and the tool reports an infinite F and a p of 0.

On NIST's reference data set SiRstv, whose certified F is 1.18046237440255, this tool gives 1.18046237. That is the check to run if you want to compare it with your own software.

Critical F at a level of 0.05, for 1 to 3 degrees of freedom between groups
df within123
104.9654.1033.708
154.5433.6823.287
204.3513.4933.098
304.1713.3162.922
604.0013.152.758
Critical F at a level of 0.05, for 4 and 5 degrees of freedom between groups
df within45
103.4783.326
153.0562.901
202.8662.711
302.692.534
602.5252.368

Common mistakes

  • Testing every pair with a plain t-test. Three groups make 3 pairs, and at 0.05 each the chance of a false alarm somewhere is about 14%. Five groups make 10 pairs and about 40%.
  • Using it on repeated measures. If the same people appear in every group, the values are not independent. That design needs a repeated-measures analysis, which this tool does not run.
  • Reading a large p as proof of equal means. It only says your data cannot separate the groups.
  • Stretching one factor to cover two. For dose and sex together, use the two-way ANOVA calculator. For ranks or badly skewed data, the Kruskal-Wallis calculator drops the normal assumption.

Questions people ask

Each extra test adds another chance of a false alarm. With 10 pairs at 0.05, the chance of at least one is about 40%. This method asks one question at the stated level first, and the pairs that follow are adjusted for how many there are.

Sources