data=dat,lambda=seq(0,0.3,0.001))) # 和线伍核性回归类似,这个plot可以画出岭迹图,lambda=seq(0,0.3,0.001)设置范围和间隔,可以观察岭迹图键族,人工选择,腔亮掘但是这样主观性较强。
(2)select(lm.ridge(GDP~Consume+Investment+IO+Population+Jobless+Goods,
data=dat,lambda=seq(0,0.3,0.001))) #利用select 函数找出最优岭参数lambda,会有三个值,任选一个即可。
lm.ridge(GDP~Consume+Investment+IO+Population+Jobless+Goods,
data=dat,lambda=0.09)#通过(1)或(2)把选取的lmbda 参数写到岭回归函数中去,在这里lambda=0.09。
利用SAS软件的reg过程的ridge=选项就很容高败易实现。假设SAS数据集辩世ds包含有用于建模的四个变量x1,x2,x3,y,岭参数的取值为0,0.002,0.0004,0.006,....,0.018,携念肢0.02,则程序如下:proc reg data=ds outstb outest=ridge_out(where=(_type_="RIDGE")) ridge=0 to 0.02 by .002
model y=x1 x2 x3/noprint
run
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)