| Home | Libraries | People | FAQ | More

## Class template wilson_interval

boost::histogram::utility::wilson_interval — Wilson interval.

## Synopsis

    // In header: <boost/histogram/utility/wilson_interval.hpp>

    template<typename ValueType>
    class wilson_interval :
      public boost::histogram::utility::binomial_proportion_interval< ValueType >
    {
    public:
      // types
      typedef typename wilson_interval::value_type    value_type;
      typedef typename wilson_interval::interval_type interval_type;

      // construct/copy/destruct
      explicit wilson_interval(deviation = deviation{1.0}) noexcept;

      // public member functions
      interval_type operator()(value_type, value_type) const noexcept;
    };

## Description

The Wilson score interval is simple to compute, has good coverage. Intervals are automatically bounded between 0 and 1 and never empty. The interval is asymmetric.

Wilson, E. B. (1927). "Probable inference, the law of succession, and statistical inference". Journal of the American Statistical Association. 22 (158): 209-212. doi:10.1080/01621459.1927.10502953. JSTOR 2276774.

The coverage probability for a random ensemble of fractions is close to the nominal value. Unlike the Clopper-Pearson interval, the Wilson score interval is not conservative. For some values of the fractions, the interval undercovers and overcovers for neighboring values. This is a shared property of all alternatives to the Clopper-Pearson interval.

The Wilson score intervals is widely recommended for general use in the literature. For a review of the literature, see R. D. Cousins, K. E. Hymes, J. Tucker, Nucl. Instrum. Meth. A 612 (2010) 388-398.

### `wilson_interval` public construct/copy/destruct

1.     explicit wilson_interval(deviation d = deviation{1.0}) noexcept;

   Construct Wilson interval computer.

   Parameters: |
   `d` | Number of standard deviations for the interval. The default value 1 corresponds to a confidence level of 68 %. Both `deviation` and``confidence_level`` objects can be used to initialize the interval.

### `wilson_interval` public member functions

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

   Compute interval for given number of successes and failures.

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