Copyright, Gerry Quinn & Mick Keough, 1998 Please do not copy or distribute this file without the authors’ permission Experimental Design & Analysis Factorial ANOVA
Two factor factorial ANOVA Two factors (2 independent variables) –Factor A (with p groups or levels) –Factor B (with q groups or levels) Crossed design: –every level of one factor crossed with every level of second factor –all combinations (i.e. cells) of factor A and factor B
Quinn (1988) - fecundity of limpets Factor A is season with 2 levels: –spring, summer Factor B is density with 4 levels: –8, 15, 30, 45 per 225cm 2 n = 3 fences in each combination: –each combination is termed a cell (8 cells) Dependent variable: –fecundity (no. egg masses per limpet)
Stehman & Meredith (1995) - growth of fir tree seedlings Factor A is nitrogen with 2 levels –present, absent Factor B is phosphorous with 4 levels –0, 100, 300, 500 kg.ha -1 8 cells, n replicate seedlings in each cell Dependent variable: –growth of Douglas fir trees seedlings
Data layout Factor A i Factor B12j12j12j Repsy 111 y ij1 y 112 y ij2 y 11k y ijk Cell meansy 11 y ij
Linear model y ijk = + i + j + ( ) ij + ijk where is overall mean i is effect of factor A i is effect of factor B ( ) ii is effect of interaction between A and B ijk is unexplained variation
Worked example SeasonSpringSummer Density Repsn = 3 in each of 8 groups (cells) p = 2 seasons, q = 4 densities
Worked example Cell means: Season Density marginal means Spring Summer Density marginal means Grand mean
Null hypotheses Main effect: –effect of one factor, pooling over levels of other factor –effect of one factor, independent of other factor Factor A marginal means (pooling B): – 1, 2... i Factor B marginal means (pooling A): – 1, 2... j
H O : no difference between marginal means of factor A, pooling levels of B –H O : 1 = 2 = i = H O : no main effect of factor A, pooling levels of B ( 1 = 2 = … = i = 0) Example: –No difference between season marginal means –No effect of season, pooling densities
Density Season means Spring spring Summer summer Density means overall 8 15 30 45 Cell means
H O : no difference between marginal means of factor B, pooling levels of A –H O : 1 = 2 = j = H O : no main effect of factor B, pooling levels of A ( 1 = 2 = … = i = 0) Example: –No difference between density marginal means –No effect of density, pooling seasons
Density Season means Spring spring Summer summer Density means overall 8 = 15 = 30 = 45 Cell means
Interaction An interaction between 2 factors: –effect of factor A is dependent on level of factor B and vice-versa H O : no interaction between factor A and factor B: –effects of factor A and factor B are independent of each other –no joint effects of A & B acting together ( ij = 0) – ij - i - j + = 0
Interaction example from Underwood (1981) Season:SummerAutumnWinterSpring Area: n = 3 plankton tows for each season/area combination DV is no. plankton in each tow cell means (each season/area combination) main effect means: season means pooling areas area means pooling seasons
MEAN NUMBER PER HAUL Interaction plot Main effects Cell meansSeason means Area means A1 A2 A1 A SAWS SEASON AREA 1 2 SAWS SEASON A1 A2
Residual variation Variation between replicates within each cell Pooled across cells if homogeneity of variance assumption holds
Partitioning total variation SS Total SS A +SS B +SS AB +SS Residual SS A variation between A marginal means SS B variation between B marginal means SS AB variation due to interaction between A and B SS Residual variation between replicates within each cell
SourceSSdfMS Factor ASS A p-1SS A p-1 Factor BSS B q-1SS B q-1 InteractionSS AB (p-1)(q-1)SS AB A X B(p-1)(q-1) ResidualSS Residual pq(n-1)SS Residual pq(n-1) Factorial ANOVA table
Worked example Season Density Interaction Residual Total SourceSS dfMS
Expected mean squares Both factors fixed: MS A 2 + nq i 2 /p-1 MS B 2 + np i 2 /q-1 MS A X B 2 + n ( ) ij 2 /(p-1)(q-1) MS Residual 2
H O : no interaction If no interaction: –H O : interaction ( ij ) = 0 true F-ratio: –MS AB / MS Residual 1 Compare F-ratio with F-distribution with (a-1)(b-1) and ab(n-1) df Determine P-value
H O : no main effects If no main effect of factor A: –H O : 1 = 2 = i = ( i = 0) is true F-ratio: –MS A / MS Residual 1 If no main effect of factor B: –H O : 1 = 2 = j = ( j = 0) is true F-ratio: –MS B / MS Residual 1
Worked example Season Density Interaction Residual Total23 SourcedfMSFP
Testing of H O ’s Test H O of no interaction first: –no significant interaction between density and season (P = 0.824) If not significant, test main effects: –significant effects of season (P = 0.001) and density (P = 0.001) Planned and unplanned comparisons: –applied to interaction and to main effects
Interpreting interactions Plotting cell means Multiple comparison across interaction term Simple main effects Treatment-contrast tests Contrast-contrast tests
Interaction plot Effect of density same for both seasons Difference between seasons same for all densities Parallel lines in cell means (interaction) plot
Worked example II Low shore Siphonaria –larger limpets Two factors –Season (spring and summer) –Density (6, 12, 24 limpets per 225cm 2 ) DV = no. egg masses per limpet n = 3 enclosures per season/density combination
Worked example II Season < Density Interaction Residual Total17 SourcedfMSFP
Interaction plot Effect of density different for each season Difference between seasons varies for each density Non-parallel lines in cell means (interaction) plot
Multiple comparison Use Tukey’s test, Bonferroni t-tests etc.: –compare all cell means in interaction Usually lots of means: –lots of non-independent comparisons Often ambiguous results Not very informative, not very powerful
Simple main effects Tests across levels of one factor for each level of second factor separately. –Is there an effect of density for winter? –Is there an effect of density for summer? Alternatively –Is there an effect of season for density = 6? –etc. Equivalent to series of one factor ANOVAs Use df Residual and MS Residual from original 2 factor ANOVA
Treatment-contrast interaction Do contrasts or trends in one factor interact with levels of other factor? Does the density contrast [6 vs the average of 12 & 24] interact with season?
Worked example II Density Simple main effects Density in winter Density in summer <0.001 Season <0.001 Density x Season Treatment-contrast inter. 6 vs (avg 12 & 24) x season Residual SourcedfMSFP
Mixed model Factor A fixed, B random: MS A 2 + n 2 + nq i 2 /p-1 MS B 2 + np 2 MS A X B 2 + n 2 MS Residual 2
Tests in mixed model H O : no effect of random interaction A*B: –F-ratio: MS AB / MS Residual H O : no effect of random factor B: –F-ratio: MS B / MS Residual H O : no effect of fixed factor A: –F-ratio: MS A / MS AB
Assumptions of factorial ANOVA Assumptions apply to DV within each cell Normality –boxplots etc. Homogeneity of residual variance –residual plots, variance vs mean plots etc. Independence
Copyright, Gerry Quinn & Mick Keough, 1998 Please do not copy or distribute this file without the authors’ permission Factorial ANOVAs in the literature
Barbeau et al. (1994) J. Exp. Mar. Biol. Ecol. 180: Experiment on consumption rate of crabs feeding on scallops Two factors: –Crab size (3 levels - small, medium, large) –Scallop size (3 levels - small, medium, large)
Dependent variable: –consumption rate (number of scallops per predator per day) of crabs (Cancer irroratus) Sample size: –n = replicate aquaria in each of 9 cells
Crab size Scallop size Interaction Residual SourcedfMSFP Unplanned multiple comparison on main effect of scallop size (pooling crab sizes): S =M<L
McIntosh et al. (1994) Ecology 75 : Effects of predatory fish on drifting behaviour of insects (mayflies) in streams Factors: –Predator cues (3 levels - no fish, galaxids, trout) –Time (2 levels - day, night)
Dependent variable: –number of mayflies drifitng Sample size: –n=3 stream channels in each cell
Predator cues Time <0.001 Interaction Residual18 SourcedfFP
Assumptions not met? Robust if equal n Transformations important No suitable non-parametric (rank- based) test