0

泊松回归在 My R 代码中如下所示:

poissmod <- glm(aerobics$y ~ factor(aerobics$x1) + factor(aerobics$x2) + aerobics$x3 + aerobics$x4, family = poisson)
poissmod

现在我必须计算该因子的置信区间aerobics$x1(在没有的模型中,aerobics$x1因为这并不重要)。

这可能看起来很容易,但我对 R 不熟悉,我无法在任何地方找到答案......

谁能帮助我?

提前非常感谢!

4

1 回答 1

2

参见包confint中的函数MASShttp://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
于 2014-03-06T11:38:11.510 回答