UNIHIVE

Study Hub UNIPORT STA 264

STA 264 · Statistics for Biological and Agricultural Sciences

Analysis of variance and covariance

One-way and two-way ANOVA, the F test, comparing means, and what covariance adds.

Our notes

2 min read

Why ANOVA

With 3 or more means, repeated t tests inflate the Type I error. With 5 treatments there are 10 pairs, so the chance of a false positive is far above 5%. ANOVA tests all the means at once.

The idea

Total variation splits into between treatments and within treatments (error).

F = MS treatment ÷ MS error.

A large F suggests the treatment means differ.

Formulas

  • Correction factor: CF = (Σx)²/N
  • Total SS = Σx² − CF
  • Treatment SS = Σ(Tᵢ²/rᵢ) − CF
  • Error SS = Total SS − Treatment SS

Worked example: CRD

Three feeds, three pens each (weight gain, kg):

FeedValuesTotal
A5, 6, 718
B8, 9, 1027
C4, 5, 615

Grand total 60; N = 9; CF = 3,600/9 = 400.

Σx² = 25 + 36 + 49 + 64 + 81 + 100 + 16 + 25 + 36 = 432.

  • Total SS = 432 − 400 = 32
  • Treatment SS = (324 + 729 + 225)/3 − 400 = 426 − 400 = 26
  • Error SS = 32 − 26 = 6
SourcedfSSMSF
Feeds2261313
Error661
Total832

Critical F(2, 6) at 5% = 5.14. Since 13 > 5.14, feeds differ.

Check of error SS: within each feed, deviations from the mean are −1, 0, 1, so each gives SS = 2. Then 3 × 2 = 6. Correct.

Which means differ?

Least significant difference (LSD):

LSD = t × √(2 MSE/r) = 2.447 × √(2 × 1/3) = 2.447 × 0.816 = 2.00

Means: A = 6, B = 9, C = 5.

  • B − A = 3: significant
  • B − C = 4: significant
  • A − C = 1: not significant

Feed B is best. Other tests, such as Tukey's or Duncan's, control errors differently. Use what your department or journal asks for.

Two-way ANOVA: RCBD

Now also remove block SS:

Block SS = Σ(Bⱼ²/t) − CF

Error SS = Total − Treatment − Block

Blocking moves field differences out of the error, so F usually rises.

Factorial ANOVA

Splits into factor A, factor B and A × B interaction. Look at the interaction first. If it is significant, compare the combinations, as the main effects alone can mislead.

Assumptions

  1. Independent errors
  2. Roughly normal errors
  3. Equal variances across treatments (homogeneity)

Check with plots of residuals. Bartlett's and Levene's tests can test equal variances. If these fail, try a transformation or a non-parametric method.

Analysis of covariance (ANCOVA)

Combines ANOVA with regression. It adjusts for a measured variable (covariate) that affects the response but isn't under test.

Example: starting weight of pigs in a feed trial. Heavier pigs may gain more, so comparing gain without adjusting could mislead. ANCOVA adjusts the means to a common starting weight, and reduces the error.

The covariate should be measured before treatments begin, so the treatment doesn't affect it.

Exams usually ask: fill in an ANOVA table; run the F test; use LSD to compare means; state the assumptions; explain why ANCOVA is used.

Common mistake: stopping at "F is significant". It only says that some means differ. You still have to say which.

Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.

Read

Watch

We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.

All STA 264 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.