[英]calculating confidence interval of coefficient in poisson regression
泊松回歸在My R-code中如下所示:
poissmod <- glm(aerobics$y ~ factor(aerobics$x1) + factor(aerobics$x2) + aerobics$x3 + aerobics$x4, family = poisson)
poissmod
現在我必須計算因子aerobics$x1
的置信區間(在沒有aerobics$x1
的模型中,因為這不重要)。
這可能看起來很容易,但我不熟悉R,我無法在任何地方找到答案......
誰可以幫助我?
非常感謝提前!
參見例如MASS
包中的confint
函數( http://stat.ethz.ch/R-manual/R-devel/library/MASS/html/confint.html ):
ldose <- rep(0:5, 2)
numdead <- c(1, 4, 9, 13, 18, 20, 0, 2, 6, 10, 12, 16)
sex <- factor(rep(c("M", "F"), c(6, 6)))
SF <- cbind(numdead, numalive = 20 - numdead)
budworm.lg0 <- glm(SF ~ sex + ldose - 1, family = binomial)
confint(budworm.lg0)
confint(budworm.lg0, "ldose")
該示例用於邏輯回歸,但這也適用於泊松回歸。
以下是泊松回歸的stats
軟件包文檔中的另一個示例( https://stat.ethz.ch/R-manual/R-devel/library/stats/html/confint.html ):
## from example(glm)
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3, 1, 9); treatment <- gl(3, 3)
glm.D93 <- glm(counts ~ outcome + treatment, family = poisson())
confint(glm.D93) # needs MASS to be present on the system
confint.default(glm.D93) # based on asymptotic normality
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.