propCI {binGroup2} | R Documentation |
Confidence intervals for one proportion in group testing
Description
Calculates point estimates and confidence intervals for a single proportion with group testing data. Methods are available for groups of equal or different sizes.
Usage
propCI(
x,
m,
n,
pt.method = "mle",
ci.method,
conf.level = 0.95,
alternative = "two.sided",
maxiter = 100,
tol = .Machine$double.eps^0.5
)
Arguments
x |
integer specifying the number of positive groups when groups are of equal size, or a vector specifying the number of positive groups among the n groups tested when group sizes differ. If the latter, this vector must be of the same length as the m and n arguments. |
m |
integer specifying the common size of groups when groups are of equal size, or a vector specifying the group sizes when group sizes differ. If the latter, this vector must be of the same length as the x and n arguments. |
n |
integer specifying the number of groups when these groups are of equal size, or a vector specifying the corresponding number of groups of the sizes m when group sizes differ. If the latter, this vector must be of the same length as the x and m arguments. |
pt.method |
character string specifying the point estimate to compute. Options include "Firth" for the bias-preventative, "Gart" and "bc-mle" for the bias-corrected MLE (where the latter allows for backward compatibility), and "mle" for the MLE. |
ci.method |
character string specifying the confidence interval to compute. Options include "AC" for the Agresti-Coull interval, "bc-skew-score" for the bias- and skewness-corrected interval, "Blaker" for the Blaker interval, "CP" for the Clopper-Pearson interval, "exact" for the exact interval as given by Hepworth (1996), "lrt" for the likelihood ratio test interval, "score" for the Wilson score interval, "skew-score" for the skewness-corrected interval, "soc" for the second-order corrected interval, and "Wald" for the Wald interval. Note that the Agresti-Coull, Blaker, Clopper-Pearson, and second-order corrected intervals can only be calculated when x, m, and n are given as integers (equal group size case). |
conf.level |
confidence level of the interval. |
alternative |
character string defining the alternative hypothesis, either "two.sided", "less", or "greater". |
maxiter |
the maximum number of steps in the iteration of confidence limits, for use only with the "exact" method when group sizes differ. |
tol |
the accuracy required for iterations in internal functions, for use with asymptotic intervals when group sizes differ only. |
Details
Confidence interval methods include the Agresti-Coull (ci.method = "AC"), bias- and skewness-corrected (ci.method = "bc-skew-score"), Blaker (ci.method = "Blaker"), Clopper-Pearson (ci.method = "CP"), exact (ci.method = "exact"), likelihood ratio test (ci.method = "lrt"), Wilson score (ci.method = "score"), skewness-corrected (ci.method = "skew-score"), second-order corrected (ci.method = "soc"), and Wald (ci.method = "Wald") intervals. The Agresti-Coull, Blaker, Clopper-Pearson, and second-order corrected intervals are available only for the equal group size case.
Point estimates available include the MLE (pt.method = "mle"), bias-corrected MLE (pt.method = "Gart" or pt.method = "bc-mle"), and bias-preventative (pt.method = "Firth"). Only the MLE method is available when calculating the Clopper-Pearson, Blaker, Agresti-Coull, second-order corrected, or exact intervals.
Equal group sizes
Computation of confidence intervals for group testing with equal group sizes are described in Tebbs & Bilder (2004) and Schaarschmidt (2007).
Unequal group sizes
While the exact method is available when group sizes differ, the algorithm becomes computationally very expensive if the number of different groups, n, becomes larger than three. See Hepworth (1996) for additional details on the exact method and other methods for constructing confidence intervals in group testing situations. For computational details and simulation results of the remaining methods, see Biggerstaff (2008). See Hepworth & Biggerstaff (2017) for recommendations on the best point estimator methods.
Value
A list containing:
conf.int |
a confidence interval for the proportion. |
estimate |
the point estimator of the proportion. |
pt.method |
the method used for point estimation. |
ci.method |
the method used for confidence interval estimation. |
conf.level |
the confidence level of the interval. |
alternative |
the alternative specified by the user. |
x |
the number of positive groups. |
m |
the group sizes. |
n |
the numbers of groups with corresponding group sizes m. |
Author(s)
This function is a combination of bgtCI
and bgtvs
written by Frank Schaarschmidt and pooledBin
written by Brad
Biggerstaff for the binGroup
package. Minor modifications have been
made for inclusion of the functions in the binGroup2
package.
References
Biggerstaff, B. (2008). “Confidence intervals for the difference of proportions estimated from pooled samples.” Journal of Agricultural, Biological, and Environmental Statistics, 13, 478–496.
Hepworth, G. (1996). “Exact confidence intervals for proportions estimated by group testing.” Biometrics, 52, 1134–1146.
Hepworth, G., Biggerstaff, B. (2017). “Bias correction in estimating proportions by pooled testing.” Journal of Agricultural, Biological, and Environmental Statistics, 22, 602–614.
Schaarschmidt, F. (2007). “Experimental design for one-sided confidence intervals or hypothesis tests in binomial group testing.” Communications in Biometry and Crop Science, 2, 32–40. ISSN 1896-0782.
Tebbs, J., Bilder, C. (2004). “Confidence interval procedures for the probability of disease transmission in multiple-vector-transfer designs.” Journal of Agricultural, Biological, and Environmental Statistics, 9, 75–90.
See Also
propDiffCI
for confidence intervals for the
difference of proportions in group testing, gtTest
for
hypothesis tests in group testing, gtPower
for power
calculations in group testing, and binom.test
for an exact
confidence interval and test.
Other estimation functions:
designEst()
,
designPower()
,
gtPower()
,
gtTest()
,
gtWidth()
,
propDiffCI()
Examples
# Example from Tebbs and Bilder (2004):
# 3 groups out of 24 test positively;
# each group has a size of 7.
# Clopper-Pearson interval:
propCI(x = 3, m = 7, n = 24, ci.method = "CP",
conf.level = 0.95, alternative = "two.sided")
# Clopper-Pearson interval with the bias-corrected
# MLE (\kbd{pt.method = "Gart"}).
propCI(x = 3, m = 7, n = 24, pt.method = "Gart",
ci.method = "CP", conf.level = 0.95,
alternative = "two.sided")
# One-sided Clopper-Pearson interval:
propCI(x = 3, m = 7, n = 24, ci.method = "CP",
conf.level = 0.95, alternative = "less")
# Blaker interval:
propCI(x = 3, m = 7, n = 24, ci.method = "Blaker",
conf.level = 0.95, alternative = "two.sided")
# Wilson score interval:
propCI(x = 3, m = 7, n = 24, ci.method = "score",
conf.level = 0.95, alternative = "two.sided")
# Calculate confidence intervals with a group size of 1.
# These match those found using the binom.confint()
# function from the binom package.
propCI(x = 4, m = 1, n = 10, pt.method = "mle",
ci.method = "AC")
propCI(x = 4, m = 1, n = 10, pt.method = "mle",
ci.method = "score")
propCI(x = 4, m = 1, n = 10, pt.method = "mle",
ci.method = "Wald")
# Example from Hepworth (1996, table 5):
# 1 group out of 2 tests positively with
# groups of size 5; also,
# 2 groups out of 3 test positively with
# groups of size 2.
propCI(x = c(1,2), m = c(5,2), n = c(2,3), ci.method = "exact")
# Bias-preventative point estimate (\kbd{pt.method = "Firth"})
# with an exact confidence interval.
propCI(x = c(1,2), m = c(5,2), n = c(2,3),
pt.method = "Firth", ci.method = "exact")
# Recalculate the example given in
# Hepworth (1996), table 5:
propCI(x = c(0,0), m = c(5,2), n = c(2,3), ci.method = "exact")
propCI(x = c(0,1), m = c(5,2), n = c(2,3), ci.method = "exact")
propCI(x = c(0,2), m = c(5,2), n = c(2,3), ci.method = "exact")
propCI(x = c(0,3), m = c(5,2), n = c(2,3), ci.method = "exact")
propCI(x = c(1,0), m = c(5,2), n = c(2,3), ci.method = "exact")
propCI(x = c(1,1), m = c(5,2), n = c(2,3), ci.method = "exact")
propCI(x = c(1,2), m = c(5,2), n = c(2,3), ci.method = "exact")
propCI(x = c(1,3), m = c(5,2), n = c(2,3), ci.method = "exact")
propCI(x = c(2,0), m = c(5,2), n = c(2,3), ci.method = "exact")
propCI(x = c(2,1), m = c(5,2), n = c(2,3), ci.method = "exact")
propCI(x = c(2,2), m = c(5,2), n = c(2,3), ci.method = "exact")
propCI(x = c(2,3), m = c(5,2), n = c(2,3), ci.method = "exact")
# Example with multiple groups of various sizes:
# 0 out of 5 groups test positively with
# groups of size 1 (individual testing);
# 0 out of 5 groups test positively with
# groups of size 5;
# 1 out of 5 groups test positively with
# groups of size 10; and
# 2 out of 5 groups test positively with
# groups of size 50.
x1 <- c(0, 0, 1, 2)
m1 <- c(1, 5, 10, 50)
n1 <- c(5, 5, 5, 5)
propCI(x = x1, m = m1, n = n1, pt.method = "Gart",
ci.method = "skew-score")
propCI(x = x1, m = m1, n = n1, pt.method = "Gart",
ci.method = "score")
# Reproducing estimates from Table 1 in
# Hepworth & Biggerstaff (2017):
propCI(x = c(1, 2), m = c(20, 5), n = c(8, 8),
pt.method = "Firth", ci.method = "lrt")
propCI(x = c(7, 8), m = c(20, 5), n = c(8, 8),
pt.method = "Firth", ci.method = "lrt")