如何读取SAS中PROC LOGISTIC和PROC REG输出的相关矩阵?
如您所知,通过选项 CORRB,您可以让 SAS 中的逻辑回归或线性回归输出估计矩阵的相关性。有趣的是,我不知道如何阅读这个矩阵。我有两个明显强正相关的变量。从PROC CORR
中,我可以看到这两个变量的皮尔逊相关系数为0.7+
。但是逻辑回归和线性回归的估计矩阵给我-0.7。相关性的强度大致相似,但符号相反。任何人都可以解释一下吗?非常感谢。
As you know, with an option CORRB
, you can let logistic regression or linear regression in SAS to output a correlations of estimates matrix. Interestingly, I am not sure how to read this matrix. I have two variables which are clearly strongly positive correlated. From PROC CORR
, I can see the pearson correlation coefficient of these two variables is 0.7+
. But the estimates matrix from both logitistic regression and linear regression give me -0.7. The strengh of the correlation is about similar but the sign is reversed. Anyone can explain it? Many thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正确地读取了这些值,它们只是意味着不同的东西。 PROC CORR 给出变量的相关性,而 CORRB 是模型中这些变量的系数的相关性。
这是对为什么正相关预测变量将具有负相关系数的直观解释。假设 y = a + b1*x1 + b2*x2 + eps。如果将
b1
从回归获得的最佳值稍微增加一点,那么y
的预测值也会增加(对于正x1
)并且会让整体的契合度变得更差。补偿该问题并使预测值更接近观测值的一种方法是减少b2
:因为x1
的高值与x2
的值较高,您将恢复到接近原始的贴合度。这表明b2
中的不确定性与b1
中的不确定性负相关:增加一个而减少另一个将导致类似的拟合。查看完美相关的极端情况可能会有所启发:
x2=x1
。那么以下内容将为您提供完全相同的预测:因此
b2 = 5-b1
和系数具有完美的负相关性。You are reading the values correctly, they just mean different things. PROC CORR gives you the correlation of the variables, while CORRB is the correlation of the coefficients of these variables in the model.
Here is an intuitive explanation of why positively correlated predictors will have negatively correlated coefficients. Suppose
y = a + b1*x1 + b2*x2 + eps
. If you increaseb1
a little from its best value obtained from the regression, then the predicted value fory
will also increase (for positivex1
) and will make the overall fit worse. One way to compensate for that and move the predicted values closer to the observed ones is to decreaseb2
: since high values ofx1
are associated with high values ofx2
, you will get back close to the original fit. This shows that the uncertainty inb2
is negatively correlated with the uncertainty inb1
: increasing one while decreasing the other will lead to similar fits.It might be instructive to look at the extreme case of perfect correlation:
x2=x1
. Then the following will give you exactly the same predictions:So
b2 = 5-b1
and the coefficients have a perfect negative correlation.