> Wheat <- read.csv("C:/Users/Pandion/Desktop/WheatYield.csv") > View(Wheat) > WheatAOVcrossed <-aov(Yield~Trtmnt*Pot, data=Wheat) # show crossed factor MS > anova(WheatAOVcrossed) Analysis of Variance Table Response: Yield Df Sum Sq Mean Sq F value Pr(>F) Trtmnt 3 393.32 131.107 458.6832 < 2.2e-16 *** Pot 2 1.71 0.854 2.9893 0.069310 . Trtmnt:Pot 6 6.38 1.063 3.7201 0.009318 ** Residuals 24 6.86 0.286 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 # Default F-ratio from Trtmnt / Residual > 131.107/0.286 #ambiguous F-ratio, two uncancelled components in numerator [1] 458.4161 # Calculate correct F-ratio using interaction term # Model I calculation, as in most text books. See Quinn and Keough > 131.107/1.063 [1] # Now Model II calculation. See Quinn and Keough. # Calculate nested factor MS > WheatAOVnested <-aov(Yield~Trtmnt+Trtmnt/Pot, data=Wheat) > anova(WheatAOVnested) Analysis of Variance Table Response: Yield Df Sum Sq Mean Sq F value Pr(>F) Trtmnt 3 393.32 131.107 458.6832 < 2.2e-16 *** Trtmnt:Pot 8 8.09 1.011 3.5374 0.007675 ** Residuals 24 6.86 0.286 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 # Default F-ratio from Trtmnt / Residual > 131.107/0.286 #ambiguous F-ratio, two uncancelled components in numerator [1] 458.4161 # Calculate F-ratio from Pot within treatment (see Quinn and Keough) > 131.107/1.011 #unambigous F-ratio, one uncancelled component [1] 129.6805 > prF<-(1-pf(c(131.107/1.011),3,8)) # p-value from correct F-ratio > prF [1] 4.023346e-07 # Use +Error() to force correct F-ratio, as shown in textbook > WheatAOVnested <-aov(Yield~Trtmnt+Error(Trtmnt/Pot), data=Wheat) > WheatAOVnestedError <-aov(Yield~Trtmnt+Error(Trtmnt/Pot), data=Wheat) > anova(WheatAOVnestedError) Error in UseMethod("anova") : no applicable method for 'anova' applied to an object of class "c('aovlist', 'listof')