p.conf
calculates confidence intervals for the binomial parameter $\pi$ (probability of success) using raw or summarized data. By default Agresti-Coull
point estimators are used to estimate $\pi$ and $\sigma_{\hat{\pi}}$. If raw data are to be used (the default) then successes should be indicated as ones and failures as zeros in the data
vector. Finite population corrections can also be specified.ci.p(data, conf = 0.95, summarized = FALSE, phat = NULL, S.phat = NULL,
fpc = FALSE, n = NULL, N = NULL, method="agresti.coull", plot = TRUE)
summarized = FALSE
.summarized = TRUE
.summarized = TRUE
.fpc = TRUE
then N
must be specified. Finite population corrections are not possible for method = "exact"
or method = "score"
summarized = TRUE
.fpc = TRUE
.method ="agresti.coull"
is the default. Other procedures include method="asymptotic"
which provides the conventional normal approximation,
method = "score
method = "LR"
.class = "ci"
.method = "LR"
finds points in the binomial log-likelhood function where the difference between the maximum likelihood and likelihood function is closest to $\chi_1^{2}(1 - \alpha)/2$
for support given in $\pi_0$. As support the function uses seq(0.00001, 0.99999, by = 0.00001)
.
The "exact" method of Clopper and Pearson (1934) is bounded at the nominal limits, but actual coverage may be well below this level, particularly when n is small and $\pi$ is near 0 or 1.
Agresti (2012) reccomends the Agresti-Coull method over the normal approximation, the score method over the Agresti-Coull method, and the likelihood ratio method over all others. The Clopper Pearson has been repeatedly criticized as being too conservative (Agresti and Coull 2012).ci.mu.z
#In 2001, it was estimated that 56,200 Americans would be diagnosed with
# non-Hodgkin's lymphoma and that 26,300 would die from it (Cernan et al. 2002).
# Here we find the 95% confidence interval for the probability of diagnosis, pi.
ci.p(c(rep(0, 56200-26300),rep(1,26300)))
ci.p(c(rep(0, 56200-26300),rep(1,26300)), method = "LR")
Run the code above in your browser using DataLab