11.4 Variance components analysis

For random effects we are often more interested in the question of how much of the variation in the response

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)






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值