I expect identical results calculating a CI for a proportion using qbinom
and binom.test
, but they are actually slightly different:
success <- 360
n <- 1226
lci <- qbinom(0.025, n, success/n)/n
uci <- qbinom(0.975, n, success/n)/n
c(lci, uci)
[1] 0.2683524 0.3189233
binom.test(success, n, success/n)$conf.int
[1] 0.2682571 0.3200123
What am I missing here?