楼主: urdaddy
3124 2

求助 [推广有奖]

  • 5关注
  • 0粉丝

统计爱好者

博士生

46%

还不是VIP/贵宾

-

威望
0
论坛币
2094 个
通用积分
5.3511
学术水平
4 点
热心指数
3 点
信用等级
2 点
经验
1218 点
帖子
194
精华
0
在线时间
317 小时
注册时间
2007-6-14
最后登录
2024-3-11

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
R中GLM过程里面的offset项是什么意思
二维码

扫码加我 拉你入群

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

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

关键词:Offset 是什么意思 Set Off 求助

回帖推荐

adobephoebus 发表于2楼  查看完整内容

R help from GLM:  offset: this can be used to specify an _a priori_ known component to          be included in the linear predictor during fitting.  This          should be 'NULL' or a numeric vector of length either one or          equal to the number of ...

本帖被以下文库推荐

沙发
adobephoebus 发表于 2008-5-17 02:17:00 |只看作者 |坛友微信交流群

offset meaning

R help from GLM:
  offset: this can be used to specify an _a priori_ known component to
          be included in the linear predictor during fitting.  This
          should be 'NULL' or a numeric vector of length either one or
          equal to the number of cases. One or more 'offset' terms can
          be included in the formula instead or as well, and if both
          are specified their sum is used.  See 'model.offset'.

Example:

clotting <- data.frame(
         u = c(5,10,15,20,30,40,60,80,100),
         lot1 = c(118,58,42,35,27,25,21,19,18),
         lot2 = c(69,35,26,21,18,16,13,12,12))

> glm(lot1 ~ log(u), data=clotting, family=Gamma)

Call:  glm(formula = lot1 ~ log(u), family = Gamma, data = clotting)

Coefficients:
(Intercept)       log(u) 
   -0.01655      0.01534 

Degrees of Freedom: 8 Total (i.e. Null);  7 Residual
Null Deviance:      3.513
Residual Deviance: 0.01673      AIC: 37.99

> glm(lot1 ~ log(u), data=clotting, family=Gamma,offset=rep(10,9))

Call:  glm(formula = lot1 ~ log(u), family = Gamma, data = clotting,      offset = rep(10, 9))

Coefficients:
(Intercept)       log(u) 
  -10.01655      0.01534 

Degrees of Freedom: 8 Total (i.e. Null);  7 Residual
Null Deviance:      3.513
Residual Deviance: 0.01673      AIC: 37.99

Then you will see the intercept decreases 10

使用道具

藤椅
snakepointid 发表于 2015-6-25 15:03:59 |只看作者 |坛友微信交流群
今天来谈谈 offset,因为看到英国精算论坛上有人问道这个问题。



用 GLM 做频率建模时通常需要用到 offset 项。offset 主要是用来调整 exposure 做单位化处理的。



这主要是因为,当在对一组保单组合进行频率建模时,我们最终需要回答的问题是每单位 exposure 对应的频率是多少。这样的话,可能大部分的保单都是,比如车险,一张保单保障了一辆车,保单期限一年,出险一次。这个时候,就不需要进行 exposure 调整。



但如果是这样的保单,比如这张保单保障了两辆车,保单期限一年,出险一次,这个时候,就不能直接对这个出险一次进行建模,因为此时保单其实包含的是两个车年,也就是2个 exposures。



此时,可以将出险次数单位化,即变为0.5次出险次数,也可以采用 offset 的形式做,理论上讲,两者的结果是一样的,如果用一个连续分布作为残差分布的话。不过,由于大家通常用离散分布做频率建模,比如泊松或者负二项,此时的一个问题就是0.5不是一个整数,如果进入建模的话会报错。当然,上面的例子如果是一张保单保障了一辆车,保单期限一年,出险两次,单位化后变为一次,那就不存在这种问题了。



不管怎样,优先推荐的还是在模型中直接采用 offset 做建模,即便不存在非整数的问题,如果去一单一单地调整出险次数为单位化次数,这个数据整理工作也是相当费事的了。



最后,用公式稍微解释一下这个关系的话,就是

log(N/Exposure)=b0+sum(bi*xi)

等价变化为 log(N)=log(Expo)+b0+sum(bi*xi)



所以有人也解释 offset 项就是上面算式中的 log(Expo),也算有直观的感觉了。

使用道具

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

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

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

GMT+8, 2024-5-13 18:42