propDiffCI {binGroup2}R Documentation

Confidence intervals for the difference of proportions in group testing

Description

Calculates confidence intervals for the difference of two proportions based on group testing data.

Usage

propDiffCI(
  x1,
  m1,
  x2,
  m2,
  n1 = rep(1, length(x1)),
  n2 = rep(1, length(x2)),
  pt.method = c("Firth", "Gart", "bc-mle", "mle"),
  ci.method = c("skew-score", "bc-skew-score", "score", "lrt", "Wald"),
  conf.level = 0.95,
  tol = .Machine$double.eps^0.5
)

Arguments

x1

vector specifying the observed number of positive groups among the number of groups tested (n1) in population 1.

m1

vector of corresponding group sizes in population 1. Must have the same length as x1.

x2

vector specifying the observed number of positive groups among the number of groups tested (n2) in population 2.

m2

vector of corresponding group sizes in population 2. Must have the same length as x2.

n1

vector of the corresponding number of groups with sizes m1.

n2

vector of the corresponding number of groups with sizes m2.

pt.method

character string specifying the point estimator to compute. Options include "Firth" for the bias-preventative estimator (Hepworth & Biggerstaff, 2017), the default "Gart" for the bias-corrected MLE (Biggerstaff, 2008), "bc-mle" (same as "Gart" for backward compatibility), and "mle" for the MLE.

ci.method

character string specifying the confidence interval to compute. Options include "skew-score" for the skewness-corrected, "score" for the score (the default), "bc-skew-score" for the bias- and skewness-corrected, "lrt" for the likelihood ratio test, and "Wald" for the Wald interval. See Biggerstaff (2008) for additional details.

conf.level

confidence level of the interval.

tol

the accuracy required for iterations in internal functions.

Details

Confidence interval methods include the Wilson score (ci.method = "score"), skewness-corrected score (ci.method = "skew-score"), bias- and skewness-corrected score (ci.method = "bc-skew-score"), likelihood ratio test (ci.method = "lrt"), and Wald (ci.method = "Wald") interval. For computational details, simulation results, and recommendations on confidence interval methods, see Biggerstaff (2008).

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"). For additional details and recommendations on point estimation, see Hepworth and Biggerstaff (2017).

Value

A list containing:

d

the estimated difference of proportions.

lcl

the lower confidence limit.

ucl

the upper confidence limit.

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.

x1

the numbers of positive groups in population 1.

m1

the sizes of the groups in population 1.

n1

the numbers of groups with corresponding group sizes m1 in population 1.

x2

the numbers of positive groups in population 2.

m2

the sizes of the groups in population 2.

n2

the numbers of groups with corresponding group sizes m2 in population 2.

Author(s)

This function was originally written as the pooledBinDiff function by Brad Biggerstaff for the binGroup package. Minor modifications were made for inclusion of the function 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., Biggerstaff, B. (2017). “Bias correction in estimating proportions by pooled testing.” Journal of Agricultural, Biological, and Environmental Statistics, 22, 602–614.

See Also

propCI for confidence intervals for one proportion in group testing, gtTest for hypothesis tests in group testing, and gtPower for power calculations in group testing.

Other estimation functions: designEst(), designPower(), gtPower(), gtTest(), gtWidth(), propCI()

Examples

# Estimate the prevalence in two populations
#   with multiple groups of various sizes:
# Population 1:
#   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.
# Population 2:
#   0 out of 5 groups test positively with
#   groups of size 1 (individual testing);
#   1 out of 5 groups test positively with
#   groups of size 5;
#   0 out of 5 groups test positively with
#   groups of size 10; and
#   4 out of 5 groups test positively with
#   groups of size 50.
x1 <- c(0, 0, 1, 2)
m <- c(1, 5, 10, 50)
n <- c(5, 5, 5, 5)
x2 <- c(0, 1, 0, 4)
propDiffCI(x1 = x1, m1 = m, x2 = x2, m2 = m, n1 = n, n2 = n,
           pt.method = "Gart", ci.method = "score")

# Compare recommended methods:
propDiffCI(x1 = x1, m1 = m, x2 = x2, m2 = m, n1 = n, n2 = n,
           pt.method = "mle", ci.method = "lrt")

propDiffCI(x1 = x1, m1 = m, x2 = x2, m2 = m, n1 = n, n2 = n,
           pt.method = "mle", ci.method = "score")

propDiffCI(x1 = x1, m1 = m, x2 = x2, m2 = m, n1 = n, n2 = n,
           pt.method = "mle", ci.method = "skew-score")

[Package binGroup2 version 1.3.1 Index]