| Home | Libraries | People | FAQ | More

## Class template clopper_pearson_interval

boost::histogram::utility::clopper_pearson_interval — Clopper-Pearson interval.

## Synopsis

    // In header: <boost/histogram/fwd.hpp>

    template<typename ValueType>
    class clopper_pearson_interval :
      public boost::histogram::utility::binomial_proportion_interval< ValueType >
    {
    public:

      // public member functions
      explicit clopper_pearson_interval(confidence_level = deviation{1}) noexcept;
      interval_type operator()(value_type, value_type) const noexcept;
    };

## Description

This is the classic frequentist interval obtained with the Neyman construction. It is therefore often called the 'exact' interval. It is guaranteed to have at least the requested confidence level for all values of the fraction.

The interval is wider than others that produce coverage closer to the expected confidence level over a random ensemble of factions. The Clopper-Pearson interval essentially always overcovers for such a random ensemble, which is undesirable in practice. The Clopper-Pearson interval is recommended when it is important to be conservative, but the Wilson interval should be preferred in most applications.

C. Clopper, E.S. Pearson (1934), Biometrika 26 (4): 404-413. doi:10.1093/biomet/26.4.404.

### `clopper_pearson_interval` public member functions

1.     explicit clopper_pearson_interval(confidence_level cl = deviation{1}) noexcept;

   Construct Clopper-Pearson interval computer.

   Parameters: |
   `cl` | Confidence level for the interval. The default value produces a confidence level of 68 % equivalent to one standard deviation. Both `deviation` and`confidence_level` objects can be used to initialize the interval.

2.     interval_type
       operator()(value_type successes, value_type failures) const noexcept;

   Compute interval for given number of successes and failures.

   Parameters: |
   `successes` | Number of successful trials.
   `failures` | Number of failed trials.