HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Program Files/R/R-4.4.0/library/MASS/tests/confint.R
library(MASS)
pdf("confint.pdf")

PropCI <- function(x, n, conf = 0.95)
{
    DF <- data.frame(y = x / n, weights = n)
    mod <- glm(y ~ 1, weights = weights, family = binomial(), data = DF)
    plogis(confint(mod, level = conf))
}

PropCI(14, 35)
## had scope error prior to 7.2-31

## single variable cases:
n.tot <- c(60,17,8,2,187,85,51,23)
n.hyp <- c(5,2,1,0,35,13,15,8)
hyp.tbl <- cbind(n.hyp, n.tot-n.hyp)
glm.hyp <- glm(hyp.tbl ~ 1, binomial)
plot(profile(glm.hyp))
x <- cbind(2,20)
plot(profile(glm(x~1,binomial)))
# failed in 7.2-39

dat <- data.frame(event = c(2,4,5), nonev = c(4,2,7))
m <- glm(cbind(event, nonev) ~ 1, data=dat, family=binomial)
confint(m)
# failed in 7.2-40