我正在分析序数逻辑回归,我想知道如何知道估计系数的方向?我的变量对于女性,男性仅是0、1,对于不同的姿势仅是0、1、2、4。所以我的问题是,我怎么知道,如果估算值描述的是从0到1的变化或从1到0的变化,是关于性别的?
输出在PicSex上添加了1,是一个信号,该信号的方向是1-> 0?参见代码。
谢谢您的帮助
Cumulative Link Mixed Model fitted with the Laplace approximation
formula: Int ~ PicSex + Posture + (1 | PicID)
data: x
Random effects:
Groups Name Variance Std.Dev.
PicID (Intercept) 0.0541 0.2326
Number of groups: PicID 16
Coefficients:
Estimate Std. Error z value Pr(>|z|)
PicSex1 0.3743 0.1833 2.042 0.0411 *
Posture -1.1232 0.1866 -6.018 1.77e-09 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
您的性别有两个级别,0或1。因此PicSex1表示PicSex的效果为1,而PicSex为0。我在下面使用酒数据集显示示例:
library(ordinal)
DATA = wine
> head(DATA$temp)
[1] cold cold cold cold warm warm
Levels: cold warm
这里感冒首先出现在Levels中,因此在任何线性模型中都将其设置为参考。首先我们验证感冒与温暖的影响
do.call(cbind,tapply(DATA$rating,DATA$temp,table))
#warm has a higher average rating
适合模特
# we fit the a model, temp is fixed effect
summary(clmm(rating ~ temp + contact+(1|judge), data = DATA))
Cumulative Link Mixed Model fitted with the Laplace approximation
formula: rating ~ temp + contact + (1 | judge)
data: DATA
link threshold nobs logLik AIC niter max.grad cond.H
logit flexible 72 -81.57 177.13 332(999) 1.03e-05 2.8e+01
Random effects:
Groups Name Variance Std.Dev.
judge (Intercept) 1.279 1.131
Number of groups: judge 9
Coefficients:
Estimate Std. Error z value Pr(>|z|)
tempwarm 3.0630 0.5954 5.145 2.68e-07 ***
contactyes 1.8349 0.5125 3.580 0.000344 ***
[在这里,我们看到温暖被附加到“温度”上,众所周知,它具有正系数,因为与寒冷(参考)相比,温暖的等级更好。
因此,如果您将另一个组设置为参考,则会看到另一个名称,并且系数是相反的(-3 ..与上一示例中的+3 ..相比]
# we set warm as reference now
DATA$temp = relevel(DATA$temp,ref="warm")
summary(clmm(rating ~ temp + contact+(1|judge), data = DATA))
Cumulative Link Mixed Model fitted with the Laplace approximation
formula: rating ~ temp + contact + (1 | judge)
data: DATA
link threshold nobs logLik AIC niter max.grad cond.H
logit flexible 72 -81.57 177.13 269(810) 1.14e-04 1.8e+01
Random effects:
Groups Name Variance Std.Dev.
judge (Intercept) 1.28 1.131
Number of groups: judge 9
Coefficients:
Estimate Std. Error z value Pr(>|z|)
tempcold -3.0630 0.5954 -5.145 2.68e-07 ***
contactyes 1.8349 0.5125 3.580 0.000344 ***
因此,在拟合模型之前,请始终检查参考是什么