Академический Документы
Профессиональный Документы
Культура Документы
Variance (ANOVA)
Peter Shaw
RU
ANOVA - a recapitulation.
This is a parametric test, examining whether the means
differ between 2 or more populations.
It generates a test statistic F, which can be thought of as a
signal:noise ratio. Thus large Values of F indicate a high
degree of pattern within the data and imply rejection of H0.
It is thus similar to the t test - in fact ANOVA on 2 groups is
equivalent to a t test [F = t2 ]
How to do an ANOVA:
table 1: Calculate total Sum of Squares for the
data Sstot = Σ (xi - μ)2
i
= Σ (xi2) – CF
i
where CF = Correction factor = (Σixi * Σ xi) /N
i
2: calculate Treatment Sum of Squares SStrt =
Σt(Xt.*Xt.)/r - CF
where Xt. = sum of all values within
treatment t
3: Draw up ANOVA table
Exact layout varies somewhat
ANOVA tables - I dislike SPSS’s version!
Learn as parrots:
Source DF SS MS F
Source df SS MS F
Error Sserr
by subtraction = SSerr / DFerr
Total N-1 Sstot Variance
One way ANOVA’s
limitations
This technique is only applicable when there
is one treatment used.
Note that the one treatment can be at 3, 4,…
many levels. Thus fertiliser trials with 10
concentrations of fertiliser could be analysed
this way, but a trial of BOTH fertiliser and
insecticide could not.
Linear models..
Although rather worrying-looking, these equations formally define the
ANOVA model being used. (By understanding these equations you can
readily derive all of ANOVA from scratch)
The formal model underlying 1-Way ANOVA with Treatment A and r
replicates:
Xir = μ + Ai + Errir
Xir is the rth replicate of Treatment A applied at level i
Ai is the effect of treatment i (= difference between μ and mean of all data in
treatment i.
Errtr is the unexplained error in Observation Xtr
Note that ΣAi = Σerrir = 0
Basic model: Data are deviations
μ from the global mean:
X = μ + Err
ir ir
Sum of vertical deviations squared
= SStot
Trt 1 Trt 2
1 way model: Data are deviations
A2 from treatment means:
A1 X = μ + A + Err
ir i ir
Sum of vertical deviations squared
= SSerr
Trt 1 Trt 2
No model
Xir just is!
H0 model:
μ X = μ + Err
ir ir
A1
Error By By
Subtraction Subtraction SSerr / DFerr
Total N-1 SStot Variance
The 2 way Linear model
The formal model underlying 2-Way ANOVA, with 2 treatments A and B
Xikr = μ + Ai + Bk + errikr
Xikr is the rth replicate of Treatment A level i and treatment B level k
Ai is the effect of the ith level of treatment A (= difference between μ and
mean of all data in this treatment.
Bk is the effect of the kth level of treatment B (= difference between μ and
mean of all data in this treatment.
Errijr is the unexplained error in Observation Xijr
Note that ΣAi = ΣBk = Σerrikr = 0
To take a worked example
(Steel & Torrie p. 343).
A1 A2 Σ
B1 66.39 182.67 249.06
B2 96.80 139.06 235.86
Σ 163.19 321.73 484.92
B alone
Source Df SS MS F
B 1 8.71 8.71 0.08 NS
error 18 1910.62 106.15
total 19 1919.33
Pooled (the correct format)
Source Df SS MS F
A 1 1256.75 1256.75 32.67**
B 1 8.71 8.71 0.24NS
error 17 653.87 38.86
total 19 1919.33
Note that we have reduced error variance and DF
by incorporating 2 treatments into one table. This
is not just good practice but technically required -
by including only one treatment in the table you
are implicitly calling the effects of the other
treatment random noise, which is incorrect.
A1 A2 A3 Σ
B1 40 60 80 180
B2 60 80 90 230
B3 100 96 80 276
Σ 200 236 250 686
Sums of squares:
SSa = 200^2/6 + 236^2/6 + 250^2/6 - CF = 221.78
SSb = 180^2/6 + 230^2/6 + 276^2/6 - CF = 768.44
Source Df SS MS F
A 2 221.78 110.89 2.1 NS
B 2 768.44 384.22 7.26**
error 13 687.56 52.89
Σ 17 1677.78
Interaction terms
We now meet a unique, powerful feature of ANOVA. It can examine data for interactions
between treatments - synergism or antagonism.
No other test allows this, while in ANOVA it is a standard feature of any 2 way table.
Note that this interaction analysis is only valid if the design is perfectly balanced. Unequal
replication or missing data points make this invalid (unlike 1 way, which is robust to
imbalance).
Synergism and
antagonism
Some treatments intensify each others’ effects:
The classic examples come from pharmacology.
Alcohol alone is lethal at the 20-40 unit range.
Barbiturates are lethal. Together they are a vastly
more lethal combination, as the 2 drugs synergise.
(In fact most sedatives and depressants show
similar dangerous synergism).
In ecology, SO2 + NO2 is more damaging than the
additive effects of each gas alone - a synergism.
Antagonism.
is the opposite - 2 treatments
nullifying each other.
Drought antagonises effects of air
pollution on plants, as drought leads
to closed stomata excluding the
noxious gas.
No interaction
Response 2
I
I Treatment B
I
I 1
I
I
I
1 2 3 Treatment A
Synergism
Response
Antagonism I
I
I I I
I I
I I
I I
1 2 3 Treatment A 1 2 3
How to do this?
Easy! We work out a sum of squares caused by ALL
treatments at ALL levels. Thus for a 3*3 design there
are really 9 treatments, etc. Call this SStrt
Now we can partition this Sum of squares: SStrt = SSA
+ SSB + SSInteraction
We know SSA, we know SSB, so we get SSinteraction by
subtraction.
To get SStrt we just add up all data in each treatment,
square this total, divide by replicates, add up and
remove CF.
For the lamb blood data:
We have 4 separate treatments:
A1B1, A1B2, A2B1, A2B2
The data within these 4 groups add
to: 66.39, 182.67, 96.80, 139.06.
There are 5 replicates
SStrt = 66.39^2/5 + 182.67^2/5 +
96.8^2/5 + 139.06^2/5 - CF =
1539.407
2 Way anova table with interaction
Source Df SS MS F
All trts 3 1539.07 ***********
A 1 1256.75 1256.75 52.93*
B 1 8.71 8.71 0.37NS
A*B 1 273.95 273.95 11.54**
error 16 379.92 23.75
Σ 19 1919.33
Interpreting the interaction
term
The hardest part of 2 way anova is trying to explain what a
significant interaction term means, in terms that make sense
to most people! Formally it is easy; you are testing H0: Ms
for interaction term is same population as MS for error.
In English let’s try “It means that you can’t reliably predict
the effect of Treatment A at level m with B at level n,
knowing only the effect of Am and Bn on their own.”
Treatment A – big effect (A2>A1)
Treatment B – mean (B1) is v
close to mean (B2) so no effect
Interaction: When A=1, B1<B2
but when A =2, B1> B2 200.00
150.00
Mean dat
100.00
50.00
0.00
1.00 2.00
a
A1B1 A1B2 A2B1 A2B2