variable can be attributed to a given factor,
than we are in estimating means or assessing the significance of differences between means. This procedure is called variance components analysis.
rats <- read.table("c:\\temp\\rats.txt",header=T)
attach(rats)
names(rats)
Three experimental treatments were administered to rats, and
the glycogen content of the rats’ livers was analysed as the response variable.
There were two rats per treatment, so the total sample was n = 3 × 2 =6.
The tricky bit was that after each rat was killed, its liver was cut up into three pieces: a left-hand bit, a
central bit and a right-hand bit. So now there are six rats each producing three bits of liver, for a total of 6 ×3 = 18 numbers.
Finally, two separate preparations were made from each macerated bit of liver, to assess the
measurement error associated with the analytical machinery.
At this point there are 2 × 18 = 36 numbers in the dataframe as a whole. The factor levels are numbers, so we need to declare the explanatory variables to be categorical before we begin:
Treatment <- factor(Treatment)
Rat <- factor(Rat)
Liver <- factor(Liver)
The simplest way to do the analysis properly is to average away the pseudoreplication. Here are the mean
glycogen values for the six rats:
(means <- tapply(Glycogen,list(Treatment,Rat),mean))
treat <- gl(3,1,length=6)
model <- aov(as.vector(means)~treat)
summary(model)
model2 <- aov(Glycogen~Treatment+Error(Treatment/Rat/Liver))
summary(model2)
varcomps <- c(21.17,14.165,36.065)
100*varcomps/sum(varcomps)