R commands for the two-factor factorial #Partial dataset: y <- c(130, 155, 74, 180, 20, 70, 82, 58, 150, 188, 159, 126, 25, 70, 58, 45) type <- as.factor(rep(1:2,each=8)) temp <- as.factor(rep(1:2, each=4, times=2)) data <- data.frame(y,type,temp) data means <- matrix(nrow=2,ncol=2) for(i in 1:2) {for (j in 1:2) means[i,j] <- mean(y[type==i & temp == j])} means par(mfrow=c(1,2)) interaction.plot(type,temp,y) interaction.plot(temp,type,y) # Full dataset: y <- c(130, 155, 74, 180, 34, 40, 80, 75, 20, 70, 82, 58, 150, 188, 159, 126, 136, 122, 106, 115, 25, 70, 58, 45, 138, 110, 168, 160, 174, 120, 150, 139, 96, 104, 82, 60) type <- as.factor(rep(1:3,each=12)) temp <- as.factor(rep(c(15,70,125),each=4,times=3)) data <- data.frame(type, temp, y) data par(mfrow=c(1,2)) interaction.plot(type,temp,y) interaction.plot(temp,type,y) means <- matrix(nrow=3,ncol=3) for(i in 1:3) {for (j in 1:3) means[i,j] <- mean(y[type==i & temp == c(15,70,125)[j]])} means g <- lm(y~type+temp+type*temp) anova(g)