pub struct ErrorRate {
pub errors: u64,
pub total: u64,
}Expand description
Errors among trials of a Bernoulli event.
Fields§
§errors: u64Number of errors $k$.
total: u64Number of trials $n$.
Implementations§
Source§impl ErrorRate
impl ErrorRate
Sourcepub fn wilson(&self, confidence: f64) -> (f64, f64)
pub fn wilson(&self, confidence: f64) -> (f64, f64)
Wilson score interval at the given confidence ((0, 1) without trials): eq. (4)
of Brown et al. (2001), BinomialInterval::Wilson.
Sourcepub fn interval(&self, method: BinomialInterval, confidence: f64) -> (f64, f64)
pub fn interval(&self, method: BinomialInterval, confidence: f64) -> (f64, f64)
The interval of the rate by method at the given confidence ((0, 1) without
trials; see BinomialInterval: the Wald and Agresti–Coull ends may leave
$[0, 1]$, as the paper defines them).
§Examples
use comnum_sim::stats::{BinomialInterval, ErrorRate};
let r = ErrorRate { errors: 3, total: 7 };
// Table 5 of Brown et al. (2001): the Jeffreys interval of 3 successes out of 7
let (lo, hi) = r.interval(BinomialInterval::Jeffreys, 0.95);
assert!((lo - 0.139).abs() < 1e-3 && (hi - 0.766).abs() < 1e-3);
// Clopper-Pearson contains Jeffreys, Agresti-Coull contains Wilson
let (cl, ch) = r.interval(BinomialInterval::ClopperPearson, 0.95);
assert!(cl < lo && hi < ch);Trait Implementations§
impl Copy for ErrorRate
impl Eq for ErrorRate
impl StructuralPartialEq for ErrorRate
Auto Trait Implementations§
impl Forget for ErrorRate
impl Freeze for ErrorRate
impl RefUnwindSafe for ErrorRate
impl Send for ErrorRate
impl Sync for ErrorRate
impl Unpin for ErrorRate
impl UnsafeUnpin for ErrorRate
impl UnwindSafe for ErrorRate
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