无论是在lm()
as in 中glm
还是在lmer
系数的默认输出中,都将它们格式化为(截距),对应于具有最高字母顺序的变量,然后是其余的系数。为了找出任何系数的实际值,有必要从(截距)基线中添加(或减去)多个中间系数,具体取决于模型。
尽管仅使用几个回归量时这不是问题,但在更复杂的模型中它很麻烦并且容易出错。例如:
对于数据:
head(trees)
site tree treatment organ sample tissue length
1 L LT01 T root 1 phloem 90.9924
2 L LT01 T root 1 xylem 123.4933
3 L LT01 T root 2 phloem 101.2444
4 L LT01 T root 2 xylem 106.0529
5 L LT01 T root 3 phloem 108.8453
6 L LT01 T root 3 xylem 126.5165
来电:
fit <- lmer(length ~ treatment + organ + tissue + (1|tree/organ/sample), data = trees)
summary(fit)
Random effects:
Groups Name Variance Std.Dev.
sample:(organ:tree) (Intercept) 1.035e-12 1.017e-06
organ:tree (Intercept) 0.000e+00 0.000e+00
tree (Intercept) 8.796e+00 2.966e+00
Residual 8.873e+01 9.420e+00
Number of obs: 360, groups: sample:(organ:tree), 180; organ:tree, 60; tree, 30
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 93.7903 1.2539 58.4000 74.798 < 2e-16 ***
treatmentT 13.5571 1.4692 28.0000 9.227 5.51e-10 ***
organstem 8.1326 0.9929 328.0000 8.191 5.77e-15 ***
tissuexylem 13.9814 0.9929 328.0000 14.081 < 2e-16 ***
产生以高度相关的方式表示的系数,这使得快速计算其中任何一个都变得乏味。
有没有办法以更直接的格式获得实际系数,至少对于固定效果而言?