我一直在阅读《应用线性统计模型》第 5 版第 11 章中对脊回归的描述。脊回归是在此处可用的体脂数据上完成的。
教科书匹配 SAS 中的输出,其中反变换系数在拟合模型中给出为:
这从 SAS 显示为:
proc reg data = ch7tab1a outest = temp outstb noprint;
model y = x1-x3 / ridge = 0.02;
run;
quit;
proc print data = temp;
where _ridge_ = 0.02 and y = -1;
var y intercept x1 x2 x3;
run;
Obs Y Intercept X1 X2 X3
2 -1 -7.40343 0.55535 0.36814 -0.19163
3 -1 0.00000 0.54633 0.37740 -0.13687
但是 R 给出了非常不同的系数:
data <- read.table("http://www.cst.cmich.edu/users/lee1c/spss/V16_materials/DataSets_v16/BodyFat-TxtFormat.txt",
sep=" ", header=FALSE)
data <- data[,c(1,3,5,7)]
colnames(data)<-c("x1","x2","x3","y")
ridge<-lm.ridge(y ~ ., data, lambda=0.02)
ridge$coef
coef(ridge)
> ridge$coef
x1 x2 x3
10.126984 -4.682273 -3.527010
> coef(ridge)
x1 x2 x3
42.2181995 2.0683914 -0.9177207 -0.9921824
>
谁能帮我理解为什么?