######################################## # # Script: 6 April 2011 (preliminary) # ######################################## # Today: # # ** Plotting # ** Analysis of variance # ** Experimental design # # Let us create a new dataset (Ex 15.1, page 960) ins <- data.frame( matrix( c(1,1,56, 1,2,48, 1,3,66, 1,4,62, 2,1,83, 2,2,78, 2,3,94, 2,4,93, 3,1,80, 3,2,72, 3,3,83, 3,4,85), ncol=3, byrow=T)) names(ins) <- c("Ins","Plot","Seedlings") ins$Plot <- as.factor(ins$Plot) ins$Ins <- as.factor(ins$Ins) ins <- data.frame(ins) attach(ins) plot(Seedlings ~ Ins + Plot) plot.design(Seedlings ~ Ins + Plot) interaction.plot(Ins,Plot,Seedlings) barplot( tapply(Seedlings, list(Ins,Plot),mean), beside=T ) m.ins <- aov(Seedlings ~ Ins + Plot) summary(m.ins) # Try fitting an interaction model here. What is the result?