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

pub struct Multinomial { /* fields omitted */ }

Multinomial distribution

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

Methods

impl Multinomial[src]

pub fn new(p: Vector<f64>) -> Multinomial[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::*;
use mathru::algebra::linear::Vector;
use mathru::statistics::distrib::Multinomial;

let distrib: Multinomial = Multinomial::new(vector![0.3; 0.2; 0.5]);

Trait Implementations

impl Discrete<Vector<u32>, Vector<f64>> for Multinomial[src]

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

Probability mass function

Arguments

  • x Random variable x &isin ࡃ

Example

use mathru::*;
use mathru::statistics::distrib::{Discrete, Multinomial};
use mathru::algebra::linear::Vector;

let p: Vector<f64> = vector![0.3; 0.7];
let distrib: Multinomial = Multinomial::new(p);
let x: Vector<u32> = vector![1; 2];
let p: f64 = distrib.pmf(x);

fn cdf<'a>(&'a self, _x: Vector<f64>) -> f64[src]

Cumulative distribution function

Arguments

  • x Random variable

Example

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

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

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

Expected value

Example

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

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

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

Variance

Example

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

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

Auto Trait Implementations

Blanket Implementations

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]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,