看板 Statistics 關於我們 聯絡資訊
應該是近期的最後一題 @@ 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
andrew43: offset也不單純是處理比例資料;「暴露量」意思比較接近 06/09 14:11
andrew43: 例如事件發生次數的觀測時間、面積、人口密度…… 06/09 14:12
andrew43: 結果也不能直接互比,意義完全不同。 06/09 14:18
marki: 所以是只要是比例資料。理論上我就是要用offset 嗎? 06/09 14:27
andrew43: 而且poisson reg怎麼可能接受非負整數之外的應變數? 06/09 14:28
andrew43: sorry我以為你改做成linear model。你要這麼做的話,可 06/09 14:35
andrew43: 採用quasipoisson,若次數很大則結果應該會很接近。 06/09 14:40
andrew43: 回到你的問題,offset的作用是調整暴露量使比較次數公 06/09 16:25
andrew43: 平。你所謂的 ”比例資料“ 的話可以視潛在事件發生的 06/09 16:25
andrew43: 所有對象數量為offset。 06/09 16:25
yhliu: 關鍵是要做 Poisson regression 還是忽略 Poisson 變量特性 06/10 10:25
yhliu: 直接用 rate 去 fit model 已經脫離 Poisson model 的假設. 06/10 10:27
collin810: Poisson是用count data喔 06/14 22:03