- The key is to construct a table of means similar to Table 1. Then SShabitat, SSyear and SSamong are computed by following the SSrow, SScolumn and SSamong formulas from the reading and class notes. The SSinteraction is then found by subtracting both SShabitat and SSyear from SSamong. The SSwithin is found by subtracting SSamong from SStotal. All degrees-of-freedom are found by formulae in the reading and class notes, noting that r=2, c=2 and n=25 (remember that n is the number of replicates per treatment in a two-way ANOVA, not the total number of individuals). The MS, F (but note that the denominator is always MSwithin), and p-values are found as usual.
- I did this in R just for fun (you did not have to use R except for the p-values).
Table 1: Means table for cattail data.
Results shown in Table 2. R code to make calculations are shown in an appendix (note, however, that you are not expected to make these calculations in R).
Table 2: Completed analysis of variance table for cattail data.
library(NCStats) tmns <- matrix(c(75.45,83.98,74.46,80.70),byrow=FALSE,nrow=2) colnames(tmns) <- c("far","near") rownames(tmns) <- c("2015","2016") mns <- addmargins(tmns,FUN=mean,quiet=TRUE) mns <- round(mns,2) r <- c <- 2 n <- 25 ssyear <- r*n*sum((mns[1:2,3]-mns[3,3])^2) sshab <- r*n*sum((mns[3,1:2]-mns[3,3])^2) ssamong <- n*sum((mns[1:2,1:2]-mns[3,3])^2) ssint <- ssamong-sshab-ssyear sstotal <- 20227.3 sswithin <- sstotal-ssamong dfamong <- r*c-1 dfyear <- r-1 dfhab <- c-1 dfint <- dfamong-dfhab-dfyear dftotal <- r*c*n-1 dfwithin <- dftotal-dfamong ss <- c(ssamong,ssyear,sshab,ssint,sswithin) df <- c(dfamong,dfyear,dfhab,dfint,dfwithin) ms <- ss/df F <- ms[-length(ms)]/ms[length(ms)] distrib(F,df1=df,df2=df,distrib="f",lower.tail=FALSE) distrib(F,df1=df,df2=df,distrib="f",lower.tail=FALSE) distrib(F,df1=df,df2=df,distrib="f",lower.tail=FALSE) distrib(F,df1=df,df2=df,distrib="f",lower.tail=FALSE)