我正在尝试在R中正确构建重复测量ANOVA并提取相关的lsmeans。我的数据由因变量(rSWC)和预测变量(Geno)组成。完整数据集如下:
> str(mydata)
'data.frame': 153 obs. of 5 variables:
$ Geno : Factor w/ 5 levels "8306","8307",..
$ BioRepeat : int 1 1 1 1 1 1 1 1 1 2 ...
$ Geno_BioRepeat: Factor w/ 17 levels "8306_1","8306_2",..
$ Day : Factor w/ 9 levels "1","2","3","4",..
$ rSWC : num 104.5 92.5 81.8 65.6 61 ...
我正在构建我的重复测量anova:
rmaModel <- aov(rSWC ~ Geno + Error(Day/Geno), data=mydata)
我希望为每个重复测量(Day)提取Geno的lsmeans(以及相关的方差项)。目前,如果我尝试提取lsmean,我只会为每个Geno获得一个lsmean和一条我无法解释的警告信息:
> library(lsmeans)
> lsmeans(rmaModel, specs = "Geno")
Geno lsmean SE df lower.CL upper.CL
8306 59.43538 8.905658 8.00 38.89890 79.97187
8307 58.06825 9.988820 12.45 35.03399 81.10251
8417 71.16686 10.158125 13.24 47.74219 94.59154
Control 86.97797 10.488538 14.84 62.79136 111.16459
WT 45.76538 9.988820 12.45 22.73112 68.79964
Confidence level used: 0.95
Warning message:
In lsm.basis.aovlist(object, trms, xlev, grid, ...) :
Some predictors are correlated with the intercept - results are biased.
May help to re-fit with different contrasts, e.g. 'contr.sum'
任何帮助,以了解我的模型是否构造得恰当,如何为每个重复测量提取lsmean,以及如何解释警告信息将非常感激。谢谢!
答案 0 :(得分:0)
R回归函数中统计检验的默认对比是治疗对比,因此“截距”水平通常是每个因子变量的第一个。警告消息表明您可能会重新定义Geno变量的对比度。这可以通过以下方式完成:
?contrasts # to get the background theory and example code
contrasts(mydata$Geno) <- contr.sum(5)
rmaModel <- aov(rSWC ~ Geno + Error(Day/Geno), data=mydata) # refit
lsmeans(rmaModel, specs = "Geno")