*! version 1.0.0 03Feb2026

Title

binomci -- Confidence intervals for binomial proportions using 12 methods

Syntax

binomci
varlist
[if]
[in]
[fweight]
[,
options]

Main
level(#) set confidence level; default is level(95)

method(method) specify confidence interval method; default is method(exact)

total display combined results for all groups when using the by prefix

separator(#) draw separator line after every # observations; default is separator(5)

Method options (one only)
exact exact (Clopper-Pearson) binomial confidence interval; the default

wald Wald confidence interval

waldcorrected Wald confidence interval with continuity correction

waldblythstill Wald-Blyth-Still confidence interval

agresti Agresti-Coull confidence interval

wilson Wilson confidence interval

jeffreys Jeffreys confidence interval

score Score confidence interval

scorecorrected Score confidence interval with continuity correction

waldlogit Wald logit confidence interval

waldlogitcorrected Wald logit confidence interval with continuity correction

arcsine Arcsine confidence interval

by is allowed with binomci; see prefix.

fweights are allowed with binomci; see weight.

Description

binomci computes confidence intervals for binomial proportions using 12 different
methods (including the 5 already offered by ci). The command is designed to provide a
comprehensive set of confidence interval methods, including both classical
and modern approaches. binomci reports the same 12 methods as those implemented in the
R program binomCI,
but for several methods, binomci computes the boundary edge cases differently. binomci
follows the recommended approaches discussed in Brown et al (2001), Newcombe (1998), and Vollset (1993).

Options

Main

level(#) specifies the confidence level, as a percentage, for confidence
intervals. The default is level(95) or as set by set level.

method(method) specifies the method for computing confidence intervals.
Available methods are: exact, wald, waldcorrected, waldblythstill,
agresti, wilson, jeffreys, score, scorecorrected,
waldlogit, waldlogitcorrected, and arcsine. If no method is specified,
the default is exact.

total may be specified only with by and requests that, in addition to
results for each by-group, results for all groups combined be displayed. The combined
results are labeled "Total".

separator(#) specifies how often separator lines are drawn between rows
in the output table. The default is separator(5), meaning that a separator
line is drawn after every 5 variables. separator(0) suppresses separator lines.

Method options

These options specify the method for computing confidence intervals. Only one method
option may be specified.

exact computes the exact (Clopper-Pearson) binomial confidence interval. This
is a conservative method that guarantees the nominal coverage probability but tends
to produce wider intervals than other methods.

wald computes the standard Wald confidence interval.

waldcorrected computes the Wald confidence interval with continuity correction.

waldblythstill computes the Wald-Blyth-Still confidence interval, which adjusts
for small sample sizes.

agresti computes the Agresti-Coull confidence interval.

wilson computes the Wilson confidence interval, which performs well for both
small and large sample sizes.

jeffreys computes the Jeffreys confidence interval, based on the Bayesian
approach with Jeffreys prior.

score computes the Score confidence interval, based on inverting the score test.

scorecorrected computes the Score confidence interval with continuity correction.

waldlogit computes the Wald confidence interval on the logit scale.

waldlogitcorrected computes the Wald confidence interval on the logit scale
with continuity correction.

arcsine computes the Arcsine (angular) transformation confidence interval.

Examples

Setup

. sysuse auto, clear

Exact binomial confidence interval (default)

. binomci foreign

Wilson confidence interval

. binomci foreign, method(wilson)

Score confidence interval with 90% confidence level

. binomci foreign, method(score) level(90)

By foreign with total, using the Wald-Blyth-Still method

. bys rep78: binomci foreign, method(waldblythstill) total

Multiple binary variables

. gen high_price = price > 5000

. gen heavy = weight > 3000

. binomci high_price heavy foreign

Remarks

binomci implements 12 different methods for computing confidence intervals for
binomial proportions (see Brown et al [2001], Newcombe [1998] and Vollset [1993] for a comprehensive discussion). The choice of method depends on the sample size, the observed
proportion, and whether boundary cases (p = 0 or p = 1) are present.

Method Recommendations by Scenario:

Small sample sizes (n < 30):

• Brown et al. (2001) recommend the Wilson and Agresti-Coull methods as
they maintain good coverage properties even with small samples.

• Newcombe (1998) found that the Wilson method performs well across all
sample sizes and is particularly recommended for small samples.

• Vollset (1993) suggests that the exact (Clopper-Pearson) method is appropriate
for very small samples but is conservative, producing wider intervals.

Large sample sizes (n ≥ 30):

• All three references agree that with large samples, most methods perform similarly,
but the Wilson and Agresti-Coull methods still have advantages in terms of
coverage probability.

• The standard Wald interval is adequate for large samples but can be problematic
when p is near 0 or 1.

Boundary cases (p = 0 or p = 1):

• Brown et al. (2001) strongly recommend against using the Wald interval for
boundary cases as it can produce nonsensical intervals (e.g., negative lower bounds).

• Newcombe (1998) found that the Wilson and score methods handle boundary
cases well, producing appropriate one-sided intervals.

• Vollset (1993) notes that the exact method naturally produces appropriate
one-sided intervals for boundary cases.

Extreme proportions (p near 0 or 1):

• Brown et al. (2001) recommend the Wilson, Agresti-Coull, and
Jeffreys intervals for extreme proportions as they avoid the zero-width problem
of the Wald interval.

• Newcombe (1998) found that methods based on score tests (Wilson and
score) perform best for extreme proportions.

Overall recommendations:

• For general use: Wilson or Agresti-Coull intervals are recommended by all
three references as they perform well across a wide range of sample sizes and
proportions.

• For small samples: Wilson is preferred over the exact method as it is less
conservative while maintaining good coverage.

• For boundary/extreme cases: Wilson, score, or Jeffreys methods are
recommended.

• Not recommended: The standard Wald interval is generally not recommended,
especially for small samples or extreme proportions, due to poor coverage properties.

• The exact method guarantees the nominal coverage but is conservative, producing
wider intervals than necessary. It may be appropriate when strict coverage guarantees
are required.

Method-Specific Notes:

• Jeffreys interval: Based on Bayesian reasoning with non-informative prior.
Performs similarly to Wilson interval but is Bayesian in interpretation.

• Score intervals: Perform well across all scenarios but are computationally
more complex.

• Wald variants: The continuity-corrected versions (waldcorrected, waldlogitcorrected,
scorecorrected) can improve coverage for small samples but may be overly conservative.

• Arcsine transformation: Historically used but generally outperformed by Wilson
and Agresti-Coull methods in modern comparisons.

Stored results

binomci stores the following in r():

Scalars

r(level) confidence level

r(ub) upper bound of confidence interval

r(lb) lower bound of confidence interval

r(se) standard error

r(prop) proportion

r(N) number of observations

r(x) number of successes

Macros

r(method) method used

Note: When multiple variables are specified, results are returned for the last variable
in the list.

References

Brown, L. D., T. T. Cai, and A. DasGupta. 2001. Interval estimation for a binomial
proportion. Statistical Science 16: 101-133.

Newcombe, R. G. 1998. Two-sided confidence intervals for the single proportion:
comparison of seven methods. Statistics in Medicine 17: 857–872.

Vollset, S. E. 1993. Confidence intervals for a binomial proportion.
Statistics in Medicine 12: 809–824.

Agresti, A., and B. A. Coull. 1998. Approximate is better than "exact" for interval
estimation of binomial proportions. American Statistician 52: 119–126.

Clopper, C., and E. S. Pearson. 1934. The use of confidence or fiducial limits
illustrated in the case of the binomial. Biometrika 26: 404–413.

Wilson, E. B. 1927. Probable inference, the law of succession, and statistical
inference. Journal of the American Statistical Association 22: 209–212.

Citation of binomci

binomci is not an official Stata command. It is a free contribution
to the research community, like a paper. Please cite it as such:

Linden A. (2026). BINOMCI: Stata module to compute confidence intervals for binomial proportions using 12 methods

Author

Ariel Linden

Linden Consulting Group, LLC

alinden@lindenconsulting.org

Also See

ci