Friday, December 21, 2012

Q: The probability of success in each of a series of independent trials is constant. How can a 95% confidence interval for this proportion be obtained?

This is called the "binomial confidence interval," and there are a few solutions. Wikipedia discusses this here: Binomial proportion confidence interval

Let's say you did 300 trials, and observed 30 successes and 270 failures.

  • One approximate method is to use an approximation to the normal distribution called the "Wald interval."

    With the example above, your 95% confidence interval would be 30/300 plus or minus 1.96 * sqrt( 30*270 / 300^3 ), or in other words between 6.6% and 13.4%.
  • Another approximate method is simply to assume that the underlying parameter p was chosen from a random variable with uniform distribution between zero and one, and then to find a region of conditional probability that contains 95% probability mass given the observation. There are many regions you could choose, but one popular choice is to arrange it so that the conditional probability is 2.5% that p lies below the lower limit of the interval, and 2.5% that p lies above the upper limit.

    In Mathematica:
    • limits[successes_, total_] := InverseBetaRegularized[{0.025, 0.975}, successes + 1, (total - successes) + 1]
    • limits[300, 1000]
      {0.0710558, 0.13922}

    This technique gives an interval between 7.1% and 13.9%. This is known as a Bayesian credibility interval with a uniform prior.
  • A sophisticated exact method is the Blyth-Still-Casella confidence interval. This method was first described in a 1986 paper by Casella and is pretty complicated. It is the preferred interval of the StatXact software from Cytel.

    I have implemented it here: , and worked to match the output of StatXAct.

    • $ ./bsctester 300 30 0.95
      Observed 30 successes in 300 trials.
      Blyth-Still-Casella 95% confidence interval: [0.06849168 0.13821040]

    The Blyth-Still-Casella interval for this test case goes between 6.8% and 13.8% and is "exact." That means that unlike the above two methods, going into the experiment this procedure is guaranteed to have at least the specified probability of including the true value, no matter what it is. For example, if you did N experiments, each with 300 trials and each with the same true value of the p parameter, and calculated a Blyth-Still-Casella 95% interval from each experiment, as N went to infinity at least 95% of the N intervals would include the right answer.

    Blyth-Still-Casella is not the only "exact" interval for this situation -- the simpler Clopper-Pearson interval is often taught in introductory statistics classes and is also exact. But the Clopper-Pearson interval will be wider than the Blyth-Still-Casella interval. "Exact" doesn't mean the interval limits are particular values; it just means the guarantee works for all values of the p parameter. We can also create an exact interval procedure that always returns the entire interval [0,1], but this is not very helpful!


  1. I hope your post is very helpful for students. I think this is one of the studying topic for students. Anyway nice.

    Best essay writing service

  2. With the advancement in technology and increased use of the internet, online education has gained significant acceptance and popularity, all over the world. With more and more degrees being offered online, traditional institutes are now facing a number of challenges. All of this has resulted in a serious competition between online and traditional educational programs, with the merits along with the demerits of both the modes of study being measured.

  3. Really useful information. we are providing best data science online training from industry experts.

  4. a pride for me to be able to discuss on a quality website because I just learned to make an article on
    cara menggugurkan kandungan

  5. Thanks for sharing amazing information !!!!!!
    Please keep up sharing.

  6. I was very pleased to find this web-site.I wanted to thanks for your time for this wonderful read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you blog post.
    Aplikasi Dapodikdasmen Terbaru

  7. TreasureBox is operated by a group of young, passionate, and ambitious people that are working diligently towards the same goal - make your every dollar count, as we believe you deserve something better.
    Check out the best
    body pillow nz
    playpen nz

  8. We find lots of learning after reading this very useful article .

  9. The item will give you a keyword rich link a great useful website page Very interesting. PLease visit link piknu

  10. Wow what a Great Information about World Day its exceptionally pleasant educational post. a debt of gratitude is in order for the post. seo

  11. Thanks for taking the time to discuss that, I feel strongly about this and so really like getting to know more on this kind of field. Do you mind updating your blog post with additional insight? It should be really useful for all of us. nba중계