[][src]Struct mathru::statistics::distrib::Binomial

pub struct Binomial<T> { /* fields omitted */ }

Binomial distribution

Fore more information: https://en.wikipedia.org/wiki/Binomial_distribution

Implementations

impl<T> Binomial<T>[src]

pub fn new(n: u32, p: T) -> Binomial<T>[src]

Create a probability distribution with

Arguments

  • p Probability that random variable, p ∈ [0, 1]
  • n number of trials, n ∈ ℕ

Panics

if p < 0 || p > 1.0

Example

use mathru::statistics::distrib::Binomial;

let distrib: Binomial<f64> = Binomial::new(5, 0.3);

Trait Implementations

impl<T> Discrete<T, u32, T> for Binomial<T> where
    T: Real
[src]

fn pmf<'a>(&'a self, x: u32) -> T[src]

Probability mass function

Arguments

  • x Random variable x &isin ࡃ

Example

use mathru::statistics::distrib::{Binomial, Discrete};

let distrib: Binomial<f64> = Binomial::new(5, 0.3);
let x: u32 = 0;
let p: f64 = distrib.pmf(x);

fn cdf<'a>(&'a self, x: T) -> T[src]

Cumulative distribution function

Arguments

  • x Random variable

Example

use mathru::statistics::distrib::{Binomial, Discrete};

let distrib: Binomial<f64> = Binomial::new(5, 0.3);
let x: f64 = 0.4;
let p: f64 = distrib.cdf(x);

fn mean<'a>(&'a self) -> T[src]

Expected value

Example

use mathru::statistics::distrib::{Binomial, Discrete};

let distrib: Binomial<f64> = Binomial::new(5, 0.3);
let mean: f64 = distrib.mean();

fn variance<'a>(&'a self) -> T[src]

Variance

Example

use mathru::statistics::distrib::{Binomial, Discrete};

let distrib: Binomial<f64> = Binomial::new(5, 0.3);
let var: f64 = distrib.variance();

Auto Trait Implementations

impl<T> RefUnwindSafe for Binomial<T> where
    T: RefUnwindSafe

impl<T> Send for Binomial<T> where
    T: Send

impl<T> Sync for Binomial<T> where
    T: Sync

impl<T> Unpin for Binomial<T> where
    T: Unpin

impl<T> UnwindSafe for Binomial<T> where
    T: UnwindSafe

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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<V, T> VZip<V> for T where
    V: MultiLane<T>,