0

我正在尝试在 R 中正确构建重复测量方差分析并提取相关的 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 ...

我将我的重复测量方差分析构建为:

rmaModel <- aov(rSWC ~ Geno + Error(Day/Geno), data=mydata)

我希望为每个重复测量(天)提取 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 以及如何解释警告消息的帮助将不胜感激。谢谢!

4

1 回答 1

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") 
于 2018-04-11T21:40:49.677 回答