楼主: ReneeBK
3325 2

[问答] ridge regression in R? [推广有奖]

  • 1关注
  • 62粉丝

VIP

学术权威

14%

还不是VIP/贵宾

-

TA的文库  其他...

R资源总汇

Panel Data Analysis

Experimental Design

威望
1
论坛币
49407 个
通用积分
51.8704
学术水平
370 点
热心指数
273 点
信用等级
335 点
经验
57815 点
帖子
4006
精华
21
在线时间
582 小时
注册时间
2005-5-8
最后登录
2023-11-26

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

Is it possible to penalize coefficients toward a number other than zero in a ridge regression in R?

For example, let's say I have dependent variable Y and independent variables X1,X2,X3, and X4. Because of the multicollinear nature of the ivs, ridge regression is appropriate. But say I'm fairly certain that the coefficient of X1 is near 5, X2 is near 1, X3 is near -1, and X4 is near -5.

Is there a ridge package and method in R where I can implement penalties on the coefficients of the ivs that penalize them toward those numbers instead of 0? I'd love to see an example in R with my example data, if possible. Thank you.


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:regression regressio regress Ridge DGE possible Because example package number

沙发
ReneeBK 发表于 2014-4-13 05:44:06 |只看作者 |坛友微信交流群
A simple way to do this is to subtract the "centering value" of the coefficient times its associated variable from the left-hand side. To go with your example,

Y=β1X1+β2X2+β3X3+β4X4+e
Assume the coefficient values should be centered at (5,1,-1,-5) respectively. Then:

Y−5X1−X2+X3+5X4=(β1−5)X1+(β2−1)X2+(β3+1)X3+(β4+5)X4+e
and, redefining terms, you have:

Y∗=β∗1X1+β∗2X2+β∗3X3+β∗4X4+e
A standard ridge regression would shrink the β∗i towards 0, which is equivalent to shrinking the original βi towards the specified centering values. to see this, consider a fully-shrunk β∗4=0, then β4+5=0 and therefore β4=−5. Shrinkage accomplished!

使用道具

藤椅
ReneeBK 发表于 2014-4-13 05:45:09 |只看作者 |坛友微信交流群
Ridge regression sets a normal prior centered at zero for each parameter. To penalize coefficients towards different values, just center the priors around your target instead of around 0. I think you can accomplish this using the bayesGLM function of the arm package with the following parameters:

prior.mean : set this to vector containing the values you want to use as the centers for your priors (the values you want to penalize "towards")
prior.df : set this to Inf to get normal priors. Possibly not necessary. There should be a way to control your prior variance, but it's not clear to me how this would be accomplished from looking at the documentation.
http://cran.r-project.org/web/packages/arm/arm.pdf

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-28 01:51