linear models two-way anova. lm anova 2 2 example -- background bacteria -- effect of temperature...
TRANSCRIPT
![Page 1: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/1.jpg)
Linear Models
Two-Way ANOVA
![Page 2: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/2.jpg)
LM ANOVA 2 2
Example -- Background
• Bacteria -- effect of temperature (10oC & 15oC) and relative humidity (20%, 40%, 60%, 80%) on growth rate (cells/d).
• 120 petri dishes with a growth medium available• Growth chambers where all environmental variables
can be controlled.
• What is the response variable, factor(s), level(s), treatment(s), replicates per treatment?
![Page 3: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/3.jpg)
LM ANOVA 2 3
Factorial or Crossed Design
• Each treatment is a combination of both factors.
Relative Humidity
20% 40% 60% 80%
Temp10oC
15oC
![Page 4: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/4.jpg)
LM ANOVA 2 4
Factorial or Crossed Design• Advantages (over two OFAT experiments)
– Efficiency – each individual “gives information” about each level of BOTH factors.
Relative Humidity
20% 40% 60% 80%
Temp10oC 15 15 15 15
15oC 15 15 15 15
Temp Relative Humidity
10oC 15oC 20% 40% 60% 80%
20 20 20 20 20 20
![Page 5: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/5.jpg)
LM ANOVA 2 5
Factorial or Crossed Design• Advantages (over two OFAT experiments)
– Efficiency – individuals “give information” about each level of BOTH factors.• Power – increased due to increased effective n.• Effect Size – detect smaller differences
– Interaction effect – can be detected.
![Page 6: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/6.jpg)
LM ANOVA 2 6
Interaction Effect• Effect of one factor on the response variable
differs depending on level of the other factor.
Relative Humidity
20% 40% 60% 80%
Temp10oC 7 10 13 15
15oC 14 12 11 8
![Page 7: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/7.jpg)
LM ANOVA 2 7
No Interaction Effect
Relative Humidity
20% 40% 60% 80%
Temp10oC 7 10 13 15
15oC 6 9 12 14
![Page 8: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/8.jpg)
LM ANOVA 2 8
Main Effects• Differences in “level” means for a factor
• “Strong” relative humidity main effect• “Weak” temperature main effect.
Relative Humidity
20% 40% 60% 80%
Temp10oC 7 10 13 15
15oC 6 9 12 14
6.5 9.5 12.5 14.5
11.25
10.25
![Page 9: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/9.jpg)
LM ANOVA 2 9
Main Effects
• “Strong” relative humidity main effect• “Weak” temperature main effect.
![Page 10: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/10.jpg)
LM ANOVA 2 10
No Effects
![Page 11: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/11.jpg)
LM ANOVA 2 11
Humidity Effect Only
![Page 12: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/12.jpg)
LM ANOVA 2 12
Temperature Effect Only
![Page 13: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/13.jpg)
LM ANOVA 2 13
Humidity and Temperature Effects
![Page 14: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/14.jpg)
LM ANOVA 2 14
Interaction Effect
![Page 15: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/15.jpg)
LM ANOVA 2 15
Example #1
Interaction EffectFactor 1 Main EffectFactor 2 Main Effect
√√
×
![Page 16: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/16.jpg)
LM ANOVA 2 16
Example #2
Interaction EffectFactor 1 Main EffectFactor 2 Main Effect
×√×
![Page 17: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/17.jpg)
LM ANOVA 2 17
Interaction EffectFactor 1 Main EffectFactor 2 Main Effect
Example #3
√
![Page 18: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/18.jpg)
LM ANOVA 2 18
Example #4
Interaction EffectFactor 1 Main EffectFactor 2 Main Effect
×
√×
![Page 19: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/19.jpg)
LM ANOVA 2 19
Interaction EffectFactor 1 Main EffectFactor 2 Main Effect
Example #5
√
![Page 20: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/20.jpg)
LM ANOVA 2 20
Interaction EffectFactor 1 Main EffectFactor 2 Main Effect
Example #6
√
![Page 21: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/21.jpg)
LM ANOVA 2 21
Example #7
Interaction EffectFactor 1 Main EffectFactor 2 Main Effect
×√√
![Page 22: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/22.jpg)
LM ANOVA 2 22
Interaction EffectFactor 1 Main EffectFactor 2 Main Effect
Example #8
√
![Page 23: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/23.jpg)
LM ANOVA 2 23
Example #9
Interaction EffectFactor 1 Main EffectFactor 2 Main Effect
××
√
![Page 24: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/24.jpg)
LM ANOVA 2 24
Interaction EffectFactor 1 Main EffectFactor 2 Main Effect
Example #10
√
![Page 25: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/25.jpg)
LM ANOVA 2 25
Terminology / Symbols• One factor is “row” factor
– r = number of levels
• Other factor is “column” factor– c = number of levels
• Yijk = response variable for kth individual in ith level of row factor and jth level of column factor• for simplicity, assume n is same for all i,j
![Page 26: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/26.jpg)
LM ANOVA 2 26
Terminology / Symbols
Column Factor
1 2 … c
Row Factor
1 …
2 …
… … … … … …
r …
…
`Y11. `Y12. `Y1c.
`Y21. `Y22. `Y2c.
`Yr1. `Yr2. `Yrc.
`Y.1. `Y.c.`Y.2.
`Y1..
`Y2..
`Yr..
`Y...
Treatment meansLevel meansGrand mean
![Page 27: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/27.jpg)
LM ANOVA 2 27
Example• What is the optimal temperature (27,35,43oC)
and concentration (0.6,0.8,1.0,1.2,1.4% by weight) of the nutrient, tryptone, for culturing the Staphylococcus aureus bacterium. Each treatment was repeated twice. The number of bacteria was recorded in millions CFU/mL (CFU=Colony Forming Units).
![Page 28: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/28.jpg)
LM ANOVA 2 29
Example -- Bacteria• What kind of effects are apparent?
10
01
50
20
02
50
Temperature (C)
me
an
of
cells
27 35 43
10
01
50
20
02
50
Concentration (%)
me
an
of
cells
0.6 0.8 1 1.2 1.4
273543
![Page 29: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/29.jpg)
LM ANOVA 2 30
2-Way ANOVA Purpose
• Determine significance of interaction and, if appropriate, two main effects.
• Are differences in means “different enough” given sampling variability?
![Page 30: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/30.jpg)
LM ANOVA 2 31
2-Way ANOVA Calculations• MSWithin is variability about ultimate full model
• MSTotal is variability about ultimate simple model
• if MSAmong is large relative to MSWithin then ultimate full model is warranted– i.e., some difference in treatment means– implies differences due to row factor, column factor, or
interaction between the two
• SSAmong = SSRow + SSCol + SSInteraction
• If MSRow is large relative to MSWithin then a difference due to the row factor is indicated– Similar argument for column and interaction effects
![Page 31: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/31.jpg)
LM ANOVA 2 32
2-Way ANOVA Calculations
r
1i
c
1j
n
1k
2...ijkTotal YY SS
r
1i
c
1j
n
1k
2.ijijkWithin YY SS
r
1i
c
1j
2
....ijAmong YYn SS
SSAmong = SSRow + SSColumn + SSInteraction
![Page 32: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/32.jpg)
LM ANOVA 2 33
2-Way ANOVA Calculations
SSRow =cn ( )å=
-r
1i
2
.....iYY SSColumn =rn ( )å
=
-c
1i
2
.... .j YY
Column Factor
1 2 … c
Row Factor
1 …
2 …
… … … … … …
r …
…
`Y11. `Y12. `Y1c.
`Y21. `Y22. `Y2c.
`Yr1. `Yr2. `Yrc.
`Y.1. `Y.c.`Y.2.
`Y1..
`Y2..
`Yr..
`Y...
![Page 33: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/33.jpg)
LM ANOVA 2 34
Two-Way ANOVA TableSource df SS MS F .
Row r-1 SSRow SSRow/[r-1] MSRow/MSWithin
Column c-1 SSCol SSCol/[c-1] MSCol/MSWithin
Inter (r-1)(c-1) SSInt SSInt/[(r-1)(c-1)] MSInt/MSWithin
Within rc(n-1) SSWithin SSWithin/[rc(n-1)]
Total rcn-1 SSTotal
![Page 34: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/34.jpg)
LM ANOVA 2 39
Review Handout – Example 1• lm()• anova()• glht()• fitPlot()• addSigLetters()
![Page 35: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/35.jpg)
LM ANOVA 2 40
Assumptions and Checking in R• Same as for the one-way ANOVA
![Page 36: Linear Models Two-Way ANOVA. LM ANOVA 2 2 Example -- Background Bacteria -- effect of temperature (10 o C & 15 o C) and relative humidity (20%, 40%, 60%,](https://reader035.vdocuments.us/reader035/viewer/2022070413/5697bfc01a28abf838ca3882/html5/thumbnails/36.jpg)
LM ANOVA 2 41
Example• Measured soil phosphorous levels in plots
near Sydney, Australia.• Each plot was characterized by type of soil
(shale- or sandstone-derived) and “topographic” location (valley, north, south, or hillside).
• Data in SoilPhosphorous.txt• Does mean soil phosphorous level differ
by soil type or topographic location?• Is there an interaction effect?