【发布时间】:2018-01-13 15:02:02
【问题描述】:
我有以下情况:
我的固定效应模型在称为“作曲家”的参与者组中找到了 Relation_PenultimateLast 的主效应。因此,我想找出 Relation_PenultimateLast 的水平在统计上与其他水平有何不同。
f.e.model.composers = lmer(Score ~ Relation_PenultimateLast + (1|TrajectoryType) + (1|StimulusType) + (1|Relation_FirstLast) + (1|LastPosition), data=datasheet.complete.composers)
摘要(f.e.model.composers)
Random effects:
Groups Name Variance Std.Dev.
TrajectoryType (Intercept) 0.005457 0.07387
LastPosition (Intercept) 0.036705 0.19159
Relation_FirstLast (Intercept) 0.004298 0.06556
StimulusType (Intercept) 0.019197 0.13855
Residual 1.318116 1.14809
Number of obs: 2200, groups:
TrajectoryType, 25; LastPosition, 8; Relation_FirstLast, 4; StimulusType, 4
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 2.90933 0.12476 14.84800 23.320 4.15e-13 ***
Relation_PenultimateLast 0.09987 0.02493 22.43100 4.006 0.000577 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
我必须对我的 lmer() 模型进行 Tukey 比较。 现在,我找到了两种比较 Relation_PenultimateLast 级别的方法(我在这里找到了它们:https://stats.stackexchange.com/questions/237512/how-to-perform-post-hoc-test-on-lmer-model):
summary(glht(f.e.model.composers, linfct = mcp(Relation_PenultimateLast = "Tukey")), test = adjusted("holm"))
和
lsmeans(f.e.model.composers, list(pairwise ~ Relation_PenultimateLast), adjust = "holm")
这些不起作用。 前者报道:
Variable(s) ‘Relation_PenultimateLast’ of class ‘integer’ is/are not contained as a factor in ‘model’
后者:
Relation_PenultimateLast lsmean SE df lower.CL upper.CL
2.6 3.168989 0.1063552 8.5 2.926218 3.41176
Degrees-of-freedom method: satterthwaite
Confidence level used: 0.95
$` of contrast`
contrast estimate SE df z.ratio p.value
(nothing) nonEst NA NA NA NA
有人可以帮我理解为什么我会得到这个结果吗?
【问题讨论】:
-
可以给我们一个minimal reproducible example吗?
-
PS 听起来您想将
Relation_PenultimateLast编码为一个因子而不是 0/1 数字变量? -
是的,但我不知道如何制作它,为您提供一个 excel 文件。有没有办法将 data.frame 转换为产生该 data.frame 的字符串?
-
我现在编辑测试主体来描述我的场景
-
我还有另一个问题,虽然我认为 CrossValidate 更正确 - 为什么我不能使用多个 lmer() 来创建多重比较?
标签: r