LAISHA Explains
Statistics and research methods

Analysis of variance, step by step

ANOVA step by step: the idea, sums of squares, the ANOVA table, F-test, critical difference and CV, assumptions and transformations, with a worked example.

Exam essential5 min read
On this page
  1. The idea
  2. Steps for a completely randomised design
  3. After a significant F: which means differ?
  4. Other designs
  5. Assumptions
  6. Key points
  7. What the exams ask
  8. Questions people ask
  9. Sources
  10. Related on Laisha
  11. Discussion

A field trial compares three nitrogen doses on four plots each. The plot yields under each dose vary, and so do the dose averages. The question is whether the averages differ more than the plot-to-plot scatter would explain. Analysis of variance (ANOVA), developed by R. A. Fisher at the Rothamsted Experimental Station in the 1920s, answers it. ANOVA splits the total variation in the data into parts due to known sources, such as treatments and blocks, and an unexplained part, the error. It then compares them with an F-test.

ANOVA is the backbone of agricultural experimentation. It is used for variety trials, fertiliser and irrigation experiments, feeding trials and laboratory assays. Doing it by hand once makes every software output easier to understand.

The idea of analysis of variance: yields of four plots under each of three nitrogen treatments are plotted as dots, with a short line at each treatment mean (20, 24 and 28) and a dashed line at the grand mean (24). Variation between treatment means is large compared with the scatter of plots within each treatment, so F is large and the treatments differ significantly 1620242832 Yield (kg per plot) grand mean 24T1 controlmean 20T2 40 kg Nmean 24T3 80 kg Nmean 28F = between ⁄ within Treatment MS = 64.0Error MS = 3.33F = 19.2 table F (2, 9), 5% = 4.26significantCD (5%) = 2.92 kg
ANOVA compares the spread between treatment means with the scatter within treatments. Here, between-treatment variation is large, so F is large.Diagram: Laisha, original.

The idea

Each observation can be written as:

observation = grand mean + treatment effect + error

If treatments have no real effect, the treatment means differ only because of error, and the variance estimated from between treatments should be about the same as the variance within treatments. Their ratio, F, should be close to 1. A large F means the treatment means are more spread out than chance allows.

Steps for a completely randomised design

For t treatments with r replications each (N = tr observations):

Sums of squares (CRD)
Correction factor: CF = G2 ⁄ N, where G = grand total
Total SS = Σx2 − CF
Treatment SS = ΣTi2 ⁄ r − CF, where Ti = treatment totals
Error SS = Total SS − Treatment SS

These go into the ANOVA table:

SourcedfSSMS = SS ⁄ dfF
Treatmentst − 1SSTMSTMST ⁄ MSE
Errort(r − 1)SSEMSE
Totaltr − 1SSTotal

The calculated F is compared with the table F at (t − 1, error df) degrees of freedom.

Worked example

Three nitrogen doses in a CRD

Plot yields (kg) are: T1 (control) 18, 20, 19, 23, total 80; T2 (40 kg N) 24, 22, 25, 25, total 96; T3 (80 kg N) 27, 29, 26, 30, total 112. The grand total is G = 288, with N = 12.

  • CF = 2882 ⁄ 12 = 6,912.
  • Total SS = Σx2 − CF = 7,070 − 6,912 = 158.
  • Treatment SS = (802 + 962 + 1122) ⁄ 4 − 6,912 = 7,040 − 6,912 = 128.
  • Error SS = 158 − 128 = 30.
  • MS: treatments 128 ⁄ 2 = 64.0; error 30 ⁄ 9 = 3.33.
  • F = 64.0 ⁄ 3.33 = 19.2. The table F (2, 9) at 5% is 4.26 (8.02 at 1%), so the treatments differ significantly.

After a significant F: which means differ?

F says only that at least one mean differs. To compare pairs, the critical difference (CD), also called the least significant difference (LSD), is widely used in Indian research:

Standard error and critical difference
SE(d) = √(2 MSE ⁄ r)
CD = SE(d) × t (at error df and chosen level)
CV (%) = √MSE ⁄ grand mean × 100

In the example, SE(d) = √(2 × 3.33 ⁄ 4) = 1.29 and t (9 df, 5%) = 2.262, so CD = 2.92 kg. The means of 20, 24 and 28 differ by 4 kg at each step, which exceeds 2.92, so all three differ from each other. CV = √3.33 ⁄ 24 × 100 = 7.6%, indicating good precision.

Other methods for comparing means include Duncan's multiple range test (DMRT), Tukey's HSD, and Dunnett's test for comparisons with a control. For quantitative treatments such as fertiliser doses, fitting a response curve (linear or quadratic) is usually more informative than pairwise tests.

Other designs

The same logic extends to other designs by splitting off more sources of variation:

  • RCBD: Total = Treatments + Blocks + Error. Removing block variation reduces error and increases precision.
  • Latin square: Total = Treatments + Rows + Columns + Error.
  • Factorial experiments: Treatments are split into main effects (A, B) and interaction (A × B).
  • Split-plot designs: There are two error terms, one for main plots and one for subplots.

Assumptions

ANOVA is valid when:

  1. Effects are additive: treatment and block effects add rather than multiply.
  2. Errors are independent, which randomisation ensures.
  3. Errors have equal variance across treatments (homoscedasticity). This can be checked with Bartlett's test or by plotting residuals.
  4. Errors are roughly normal.

When these assumptions fail, the data can be transformed before analysis:

DataTransformation
Counts (insects, weeds), with variance ≈ meanSquare root, √x or √(x + 0.5)
Data with variance growing with the mean, or multiplicative effectsLogarithm, log(x) or log(x + 1)
Percentages and proportions, especially outside 30–70%Arcsine (angular), sin−1√p

Results are analysed on the transformed scale and back-transformed for presentation. Non-parametric tests such as Kruskal–Wallis are an alternative.

Key points

  • ANOVA splits total variation into known sources and error, and tests treatments with F = MStreatment ⁄ MSerror.
  • Steps: CF = G2 ⁄ N; Total SS = Σx2 − CF; Treatment SS = ΣT2 ⁄ r − CF; Error SS = the remainder; MS = SS ⁄ df.
  • CRD df: treatments t − 1, error t(r − 1), total tr − 1. RCBD also removes blocks (r − 1).
  • After a significant F, compare means with CD = t × √(2MSE ⁄ r), DMRT or Tukey's test.
  • CV = √MSE ⁄ mean × 100 measures precision.
  • Assumptions are additivity, independence, equal variance and normality. Use square root, log or arcsine transformations when needed.

What the exams ask

  • Complete an ANOVA table from data or from partial information.
  • State degrees of freedom for CRD, RCBD and Latin square.
  • Calculate and interpret CD and CV.
  • List the assumptions of ANOVA and appropriate transformations.
  • Explain why ANOVA is preferred to multiple t-tests.

Described in general terms: the kind of examination, not a past paper. Laisha never reproduces exam questions.

Questions people ask

Why not just do t-tests between all pairs?

With three treatments there are three pairs, and with ten there are 45. Each test at 5% carries a 5% risk of a false positive, so with many tests the chance of at least one false "significant" result becomes large. ANOVA tests all treatments together at the chosen level, and pooling error across all treatments also gives a better error estimate.

What does a non-significant F mean?

It means the experiment did not detect differences among treatments larger than the error variation. The treatments may truly be similar, or the trial may have been too small or too variable to detect real differences. Look at the CV and the size of the differences before concluding.

Can I calculate CD if F is not significant?

You can, but you should not use it to declare differences. Most textbooks recommend comparing means only when the overall F is significant, to protect against false positives. Some planned contrasts specified before the experiment are an exception.

Sources

  1. Fisher, R. A. Statistical Methods for Research Workers. Oliver and Boyd, Edinburgh, 1925.
  2. Gomez, K. A. and Gomez, A. A. Statistical Procedures for Agricultural Research, 2nd edition. Wiley, 1984.
  3. Panse, V. G. and Sukhatme, P. V. Statistical Methods for Agricultural Workers, 4th edition. ICAR, New Delhi, 1985.
  4. Montgomery, D. C. Design and Analysis of Experiments, 9th edition. Wiley, 2017.

More in statistics and research methods

Discussion

Questions, corrections and notes from readers on this article. Every comment is checked before it appears: keep it on the topic, and do not share phone numbers, links or contact details.

Last reviewed

Ask Laisha about this

Opens Laisha's chat with your question ready to send. Sign in or start free.