(SO的第一个问题,对任何错误深表歉意!(
我试图用线性混合模型分析数据,考虑块(图(和基因型(线(效应,并对自由度进行Welch-Satterthwaite调整,以考虑WT(对照(的不同复制率。这是一个不完整的区块设计,每个区块都包含WT。
我已经使用lmerTest::lmer
来构建模型
library(lmerTest)
biomass.lmer <- lmer(sqrt(Leaf_area) ~ Line + (1 | Plot) ,
data = biomass.allmeans)
anova(biomass.lmer)
到目前为止,一切都很好。考虑了df的Satterthwaite校正。但当我尝试做一个事后Dunnett测试时
dunnett.test <- glht(anova(biomass.lmer), linfct = mcp( Line = "Dunnett"), alternative = "two.sided")
summary(dunnett.test)
它不起作用。glht
无法处理由lmerTest::anova
返回的S4对象。然而,lmerTest::lmer
和lme4::lmer
都返回了一个有效的对象,但后者不能考虑Satterthwaite校正。
问题
我是不是错过了什么?任何关于如何将校正模型的方差转化为有效对象或使用不同的方法对S4对象进行Dunnett测试的建议都将不胜感激。
根据建议,数据(生物量.allmeans(:
structure(list(Line = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L), .Label = c("WT", "11-008",
"14-005", "2-94", "7-028", "8-93"), class = "factor"), Plot = structure(c(1L,
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 2L, 4L, 5L, 8L,
9L, 10L, 11L, 2L, 3L, 5L, 7L, 8L, 10L, 12L, 1L, 3L, 5L, 6L, 7L,
9L, 12L, 1L, 2L, 4L, 6L, 7L, 10L, 11L, 12L, 1L, 3L, 4L, 6L, 8L,
9L, 11L), .Label = c("1", "2", "3", "4", "5", "6", "7", "8",
"9", "10", "11", "12"), class = "factor"), Leaf_area = c(3579.5,
3316.25, 4018.25, 3381, 3697.75, 2938.75, 2487.75, 1529.25, 2514.75,
2713.5, 2037.5, 3696.25, 3350, 1790.75, 1270, 2706.75, 2517.25,
4715, 3409.75, 3488.75, 2583.75, 1863, 1749.25, 2001, 2530.25,
3012, 3514.25, 2871.25, 1740.75, 2745.25, 3279, 2826.5, 3744.25,
1297.25, 1123.75, 691.5, 1263, 684.666666666667, 891.25, 873.5,
1461, 5217.75, 4867.25, 4629.75, 3748, 2693.75, 1615.5, 4407)), .Names = c("Line",
"Plot", "Leaf_area"), class = "data.frame", row.names = c(NA,
-48L))
我在namespace
中看到了anova.lmerModLmerTest
,但由于某种原因我无法访问它。R
认为该函数不存在。对不起,我只能用stats::anova
运行它,但我不确定这是实际的问题。?glht
正在寻找一个模型。因此,如果我只是用lmer
模型运行它,它就可以工作了。
stats::anova(biomass.lmer)
Type III Analysis of Variance Table with Satterthwaite's method
Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Line 4131.8 826.36 5 33.434 18.084 1.146e-08 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
重要的结果,包括对df的Satterthwaite校正,所以运行post-hoc。
dunnett.test <- glht((biomass.lmer), linfct = mcp(Line = "Dunnett"), alternative = "two.sided")
General Linear Hypotheses
Multiple Comparisons of Means: Dunnett Contrasts
Linear Hypotheses:
Estimate
11-008 - WT == 0 -0.6996
14-005 - WT == 0 -5.1471
2-94 - WT == 0 -0.2379
7-028 - WT == 0 -23.7876
8-93 - WT == 0 7.5590
summary(dunnett.test)
Simultaneous Tests for General Linear Hypotheses
Multiple Comparisons of Means: Dunnett Contrasts
Fit: lmer(formula = sqrt(Leaf_area) ~ Line + (1 | Plot), data = biomass.allmeans)
Linear Hypotheses:
Estimate Std. Error z value Pr(>|z|)
11-008 - WT == 0 -0.6996 3.2885 -0.213 0.9998
14-005 - WT == 0 -5.1471 3.2885 -1.565 0.4198
2-94 - WT == 0 -0.2379 3.2885 -0.072 1.0000
7-028 - WT == 0 -23.7876 3.1372 -7.582 <0.001 ***
8-93 - WT == 0 7.5590 3.2885 2.299 0.0943 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Adjusted p values reported -- single-step method)