lm.ridge {MASS}中$ coef,coef(),list()和plot()之间的区别

时间:2017-03-07 02:10:50

标签: r plot

最近,当我研究lm.ridge函数时,我发现这个函数有完全不同的系数,我不知道哪个是正确的,而不是与情节比较。 例如,

 longley  #lm.ridge example
 names(longley)[1] <- "y"
 rid.long <- lm.ridge(y ~ ., longley)  #set lambda = 0 as OLS
 list(rid.long)   #it is the same as coef(rid.long)
 [[1]]
                   GNP            Unemployed  Armed.Forces    Population       Year      Employed
 2946.85636017    0.26352725    0.03648291    0.01116105   -1.73702984  -1.41879853    0.23128785 

 coef(rid.long)  #it is the same as list(rid.long)
                   GNP            Unemployed  Armed.Forces    Population       Year      Employed 
  2946.85636017    0.26352725    0.03648291    0.01116105   -1.73702984   -1.41879853    0.23128785 

 rid.long$coef  #it is totally different above two, and same as plot
        GNP   Unemployed Armed.Forces   Population         Year     Employed 
 25.3615288    3.3009416    0.7520553  -11.6992718   -6.5403380    0.7864825 

 plot(lm.ridge(y ~ ., longley, lambda = seq(0,0.1,0.001)))

enter image description here

为什么示例图中的y轴捕获rid.long$coef作为默认值,但不是coef(rid.long)?这两个载体之间有什么不同?当我绘制脊线迹线时,我怎么能(或应该)改变y轴分量?我还查看了帮助附件中的coef方法解释,但我仍然无法区分它们。

0 个答案:

没有答案