使用 R 的泊松回归中的语句暴露
statement exposure in poisson regression using R
我正在尝试使用泊松回归在 R 中拟合来自 Frome(1983) 的模型,但我不知道如何添加曝光:ln(person-years),模型是:
ln E(Y|X)= ln(人-年)+ B0+ B1X1+ B2X2.
你知道那有多合身吗?
您可以使用以下 R 代码执行泊松回归分析。
m1<- glm(y ~ offset(log(person-years))+X1+X2, family="poisson", data=dat)
summary(m1)
因为你使用了'log(person-years)'的偏移量,所以'log(person-years)'的系数被强制为1。
我正在尝试使用泊松回归在 R 中拟合来自 Frome(1983) 的模型,但我不知道如何添加曝光:ln(person-years),模型是:
ln E(Y|X)= ln(人-年)+ B0+ B1X1+ B2X2.
你知道那有多合身吗?
您可以使用以下 R 代码执行泊松回归分析。
m1<- glm(y ~ offset(log(person-years))+X1+X2, family="poisson", data=dat)
summary(m1)
因为你使用了'log(person-years)'的偏移量,所以'log(person-years)'的系数被强制为1。