# NOT RUN {
# 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")
# }
Run the code above in your browser using DataLab