Melvin's digital garden

confidence interval

Exact CIs must include the parameter at the given confidence level.

Most CIs are approximate, faster to compute.

Exact tests may be inverted to get an exact CI but these are usually too large.

One of the basic problem is confidence interval for observing proportion p in n samples.

For example, what is the proportion of reviews that are positive?

Python implementation of several methods for proportion CI in statsmodels.stats.proportion.proportion_confint

Web calculator for proportion CI using Wilson, Jeffreys, Agresti-Coull, Clopper-Pearson

Fieller’s theorem for CI of ratio of two means

Dance of the CIs

CI for difference of medians

  • Statistical Inference for a Linear Function of Medians
  • statpsych function ci.median2


  • ExactCIdiff: An R Package for Computing Exact Confidence Intervals for the Difference of Two Proportions
  • Exact Confidence Intervals for the Relative Risk and the Odds Ratio


  • Bayesian counterpart is the credible interval
  • For hypothesis testing, also see Bayes Factor