[][src]Struct probability::distribution::Binomial

pub struct Binomial { /* fields omitted */ }

A binomial distribution.

Methods

impl Binomial[src]

pub fn new(n: usize, p: f64) -> Self[src]

Create a binomial distribution with n trails and success probability p.

It should hold that p >= 0 and p <= 1.

pub fn with_failure(n: usize, q: f64) -> Self[src]

Create a binomial distribution with n trails and failure probability q.

It should hold that if q >= 0 or q <= 1. This constructor is preferable when q is very small.

pub fn n(&self) -> usize[src]

Return the number of trials.

pub fn p(&self) -> f64[src]

Return the success probability.

pub fn q(&self) -> f64[src]

Return the failure probability.

Trait Implementations

impl Discrete for Binomial[src]

fn mass(&self, x: usize) -> f64[src]

Compute the probability mass function.

For large n, a saddle-point expansion is used for more accurate computation.

References

  1. C. Loader, “Fast and Accurate Computation of Binomial Probabilities,”

impl Distribution for Binomial[src]

type Value = usize

The type of outcomes.

fn distribution(&self, x: f64) -> f64[src]

Compute the cumulative distribution function.

The implementation is based on the incomplete beta function.

impl Entropy for Binomial[src]

impl Inverse for Binomial[src]

fn inverse(&self, p: f64) -> usize[src]

Compute the inverse of the cumulative distribution function.

For small n, a simple summation is utilized. For large n and large variances, a normal asymptotic approximation is used. Otherwise, the Newton method is employed.

References

  1. S. Moorhead, “Efficient evaluation of the inverse binomial cumulative distribution function where the number of trials is large,” Oxford University, 2013.

impl Kurtosis for Binomial[src]

impl Mean for Binomial[src]

impl Median for Binomial[src]

impl Modes for Binomial[src]

impl Sample for Binomial[src]

impl Skewness for Binomial[src]

impl Variance for Binomial[src]

fn deviation(&self) -> f64[src]

Compute the standard deviation.

impl Clone for Binomial[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Copy for Binomial[src]

impl Debug for Binomial[src]

Auto Trait Implementations

impl Send for Binomial

impl Sync for Binomial

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]