| Home | Libraries | People | FAQ | More

## Class template wald_interval

boost::histogram::utility::wald_interval — Wald interval or normal approximation interval.

## Synopsis

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

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

      // public member functions
      explicit wald_interval(deviation = deviation{1.0}) noexcept;
      interval_type operator()(value_type, value_type) const noexcept;
    };

## Description

The Wald interval is a symmetric interval. It is simple to compute, but has poor statistical properties and is universally rejected by statisticians. It should always be replaced by another iternal, for example, the Wilson interval.

The Wald interval can be derived easily using the plug-in estimate of the variance for the binomial distribution, which is likely a reason for its omnipresence. Without further insight into statistical theory, it is not obvious that this derivation is flawed and that better alternatives exist.

The Wald interval undercovers on average. It is unsuitable when the sample size is small or when the fraction is close to 0 or 1. e. Its limits are not naturally bounded by 0 or 1. It produces empty intervals if the number of successes or failures is zero.

For a critique of the Wald interval, see (a selection):

L.D. Brown, T.T. Cai, A. DasGupta, Statistical Science 16 (2001) 101-133. R. D. Cousins, K. E. Hymes, J. Tucker, Nucl. Instrum. Meth. A 612 (2010) 388-398.

### `wald_interval` public member functions

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

   Construct Wald 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.

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.