pub enum BinomialInterval {
Wald,
Wilson,
AgrestiCoull,
Jeffreys,
ClopperPearson,
}Expand description
A confidence interval of a binomial proportion $p$ from $k$ successes among $n$ trials, $\hat{p} = k/n$, $z = \Phi^{-1}(1 - \alpha/2)$ (Brown, Cai & DasGupta 2001, with their equations):
Wald, eq. (1): $\hat{p} \pm z \sqrt{\hat{p}(1 - \hat{p})/n}$, the textbook interval, whose coverage oscillates far below $1 - \alpha$ (a single point at $k = 0$ or $n$);Wilson, eq. (4): the score interval (the default of the runner);AgrestiCoull, eq. (5): the Wald interval of $\tilde{p} = (k + z^{2}/2)/(n + z^{2})$ with $\tilde{n} = n + z^{2}$, which contains the Wilson interval;Jeffreys, eqs. (6)–(8): the $\alpha/2$ and $1 - \alpha/2$ quantiles of $\mathrm{Beta}(k + 1/2, n - k + 1/2)$, 0 at $k = 0$ and 1 at $k = n$;ClopperPearson, Sec. 4.2.1: the quantiles of $\mathrm{Beta}(k, n - k + 1)$ and $\mathrm{Beta}(k + 1, n - k)$, the “exact” interval whose coverage never falls below $1 - \alpha$.
The Wald and Agresti–Coull intervals are returned as the paper defines them, not truncated to $[0, 1]$: their expected lengths are those of its Sec. 3.3 (Fig. 8), and truncating them would not change their coverage of $p \in (0, 1)$.
Variants§
Wald
The standard interval, eq. (1).
Wilson
The score interval, eq. (4).
AgrestiCoull
The Agresti–Coull interval, eq. (5).
Jeffreys
The equal-tailed Jeffreys interval, eqs. (6)–(8).
ClopperPearson
The Clopper–Pearson interval, Sec. 4.2.1.
Implementations§
Trait Implementations§
Source§impl Clone for BinomialInterval
impl Clone for BinomialInterval
impl Copy for BinomialInterval
Source§impl Debug for BinomialInterval
impl Debug for BinomialInterval
impl Eq for BinomialInterval
Source§impl FromStr for BinomialInterval
impl FromStr for BinomialInterval
Source§impl Hash for BinomialInterval
impl Hash for BinomialInterval
Source§impl PartialEq for BinomialInterval
impl PartialEq for BinomialInterval
impl StructuralPartialEq for BinomialInterval
Auto Trait Implementations§
impl Freeze for BinomialInterval
impl RefUnwindSafe for BinomialInterval
impl Send for BinomialInterval
impl Sync for BinomialInterval
impl Unpin for BinomialInterval
impl UnsafeUnpin for BinomialInterval
impl UnwindSafe for BinomialInterval
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more