Poisson offset問題
應該是近期的最後一題 @@
https://sites.google.com/site/rlearningsite/catagory/poisson
網頁的最後倒數第二個部分 5.Poisson迴歸應用於比例資料
裡面有提到如果是要計算比例資料 要設offset
我的問題是為什麼不能直接先算出每一年的cancer占死亡人口的比率
再把這個比率放到應變數跑就好呢?
我試著這樣子跑 會有些許的差異 不清楚為什麼?
我的R code如下:
> death=read.csv("/Users/chihchiachen/Downloads/Death.csv")
> Year_re<-c(24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
> death_cb<-cbind(death, cbind(Year_re))
> deathc=death_cb$Cancer/death_cb$Death #deathc就是cancer占死亡人口的比例
> death_cb<-cbind(death_cb, cbind(deathc))
> glm(formula = deathc ~ Year_re, family = poisson(link = log),
data = death_cb)
結果:
(Intercept) Year_re
-1.7488 0.0229
跟網頁上的資料
Intercept 的coef是0.022461 Inctercept是-1.742616有些許的差異
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.116.253.37 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Statistics/M.1591671802.A.C5D.html
→
06/09 14:11,
4年前
, 1F
06/09 14:11, 1F
→
06/09 14:12,
4年前
, 2F
06/09 14:12, 2F
推
06/09 14:18,
4年前
, 3F
06/09 14:18, 3F
→
06/09 14:27,
4年前
, 4F
06/09 14:27, 4F
→
06/09 14:28,
4年前
, 5F
06/09 14:28, 5F
→
06/09 14:35,
4年前
, 6F
06/09 14:35, 6F
→
06/09 14:40,
4年前
, 7F
06/09 14:40, 7F
推
06/09 16:25,
4年前
, 8F
06/09 16:25, 8F
→
06/09 16:25,
4年前
, 9F
06/09 16:25, 9F
→
06/09 16:25,
4年前
, 10F
06/09 16:25, 10F
→
06/10 10:25,
4年前
, 11F
06/10 10:25, 11F
→
06/10 10:27,
4年前
, 12F
06/10 10:27, 12F
推
06/14 22:03,
4年前
, 13F
06/14 22:03, 13F