(关于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测试的任何建议。
根据建议,数据(biomass.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))
答案 0 :(得分:0)
我在其anova.lmerModLmerTest
中看到了namespace
,但是由于某种原因我无法访问它。 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校正,因此运行事后。
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)