lme4 输出中的未知符号
Unknown symbol in lme4 output
我已经用 R 中的 lme4
包拟合了一个线性混合效应模型。我正在预测一个连续的 outcome
变量,它具有两个分类固定因子,direction
(upwards/downwards) 和 utility
(positive/neutral/negative),以及 Participant
作为随机因子。我想测试 direction
、utility
以及两者在 outcome
上的交互作用,所以我写了一个这样的模型:
model <- lmer(outcome ~ direction * utility + (1|Participant), data = DF)
输出如下所示:
Linear mixed model fit by REML ['lmerMod']
Formula: outcome ~ direction * utility + (1 | Participant)
Data: DF
REML criterion at convergence: 35381.7
Scaled residuals:
Min 1Q Median 3Q Max
-4.5722 -0.5269 -0.2075 0.2518 5.8625
Random effects:
Groups Name Variance Std.Dev.
Participant (Intercept) 5.832 2.415
Residual 96.155 9.806
Number of obs: 4761, groups: Participant, 100
Fixed effects:
Estimate Std. Error t value
(Intercept) 8.9769 0.3189 28.153
directionUpwards -6.1652 0.2912 -21.172
utility.L -4.1623 0.3577 -11.635
utility.Q -3.0612 0.3668 -8.346
directionUpwards:utility.L 4.2283 0.5000 8.456
directionUpwards:utility.Q 3.6176 0.5049 7.165
Correlation of Fixed Effects:
(Intr) drctnU utlt.L utlt.Q drU:.L
drctnUpwrds -0.473
utility.L -0.068 0.076
utility.Q -0.019 0.019 -0.070
drctnUpw:.L 0.051 0.008 -0.720 0.049
drctnUpw:.Q 0.015 -0.020 0.052 -0.720 0.011
输出中 utility
后面的 L 和 Q 是什么意思?由于它们不对应于 utility
的可能值,我不确定如何解释这一点。
这不是 lme4
特定的。
这些项是正交多项式对比的线性 (L
) 和二次 (Q
) 系数;发生这种情况是因为 utility
已被定义为 有序因子 。如果您有更多级别的因子,它们将被标记为 C
(立方)、4
、(quartic/4th-order)、5
等
如果您想回到因子的普通行为(即处理对比),您可以将 utility
转换回无序(data <- transform(data,utility=factor(utility,ordered=FALSE))
)或使用各种方法之一来指定你想要治疗对比。
L
和Q
代表线性和二次对比。默认情况下,R 对无序因子进行处理对比,对有序因子进行多项式对比。
你可以这样查看R对比
> options('contrasts')
$contrasts
unordered ordered
"contr.treatment" "contr.poly"
听起来您期待的是治疗对比。您可以像这样更改 R 对有序因子的对比度
> options(contrasts=c('contr.treatment','contr.treatment'))
另一种选择是将您的因子转换为无序。例如,
DF$direction = factor(DF$direction, ordered = FALSE)
我已经用 R 中的 lme4
包拟合了一个线性混合效应模型。我正在预测一个连续的 outcome
变量,它具有两个分类固定因子,direction
(upwards/downwards) 和 utility
(positive/neutral/negative),以及 Participant
作为随机因子。我想测试 direction
、utility
以及两者在 outcome
上的交互作用,所以我写了一个这样的模型:
model <- lmer(outcome ~ direction * utility + (1|Participant), data = DF)
输出如下所示:
Linear mixed model fit by REML ['lmerMod']
Formula: outcome ~ direction * utility + (1 | Participant)
Data: DF
REML criterion at convergence: 35381.7
Scaled residuals:
Min 1Q Median 3Q Max
-4.5722 -0.5269 -0.2075 0.2518 5.8625
Random effects:
Groups Name Variance Std.Dev.
Participant (Intercept) 5.832 2.415
Residual 96.155 9.806
Number of obs: 4761, groups: Participant, 100
Fixed effects:
Estimate Std. Error t value
(Intercept) 8.9769 0.3189 28.153
directionUpwards -6.1652 0.2912 -21.172
utility.L -4.1623 0.3577 -11.635
utility.Q -3.0612 0.3668 -8.346
directionUpwards:utility.L 4.2283 0.5000 8.456
directionUpwards:utility.Q 3.6176 0.5049 7.165
Correlation of Fixed Effects:
(Intr) drctnU utlt.L utlt.Q drU:.L
drctnUpwrds -0.473
utility.L -0.068 0.076
utility.Q -0.019 0.019 -0.070
drctnUpw:.L 0.051 0.008 -0.720 0.049
drctnUpw:.Q 0.015 -0.020 0.052 -0.720 0.011
输出中 utility
后面的 L 和 Q 是什么意思?由于它们不对应于 utility
的可能值,我不确定如何解释这一点。
这不是 lme4
特定的。
这些项是正交多项式对比的线性 (L
) 和二次 (Q
) 系数;发生这种情况是因为 utility
已被定义为 有序因子 。如果您有更多级别的因子,它们将被标记为 C
(立方)、4
、(quartic/4th-order)、5
等
如果您想回到因子的普通行为(即处理对比),您可以将 utility
转换回无序(data <- transform(data,utility=factor(utility,ordered=FALSE))
)或使用各种方法之一来指定你想要治疗对比。
L
和Q
代表线性和二次对比。默认情况下,R 对无序因子进行处理对比,对有序因子进行多项式对比。
你可以这样查看R对比
> options('contrasts')
$contrasts
unordered ordered
"contr.treatment" "contr.poly"
听起来您期待的是治疗对比。您可以像这样更改 R 对有序因子的对比度
> options(contrasts=c('contr.treatment','contr.treatment'))
另一种选择是将您的因子转换为无序。例如,
DF$direction = factor(DF$direction, ordered = FALSE)