Struct probability::prelude::Categorical [] [src]

pub struct Categorical {
    // some fields omitted
}

A categorical distribution.

Methods

impl Categorical
[src]

fn new(p: &[f64]) -> Categorical

Create a categorical distribution with success probability p.

It should hold that p[i] >= 0, p[i] <= 1, and sum(p) == 1.

fn k(&self) -> usize

Return the number of categories.

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

Return the event probabilities.

Trait Implementations

impl Clone for Categorical
[src]

fn clone(&self) -> Categorical

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Distribution for Categorical
[src]

type Value = usize

The type of outcomes.

fn cdf(&self, x: f64) -> f64

Compute the distribution function. Read more

impl Discrete for Categorical
[src]

fn pmf(&self, x: usize) -> f64

Compute the probability mass function.

impl Entropy for Categorical
[src]

fn entropy(&self) -> f64

Compute the differential entropy. Read more

impl Inverse for Categorical
[src]

fn inv_cdf(&self, p: f64) -> usize

Compute the inverse of the distribution function.

impl Kurtosis for Categorical
[src]

fn kurtosis(&self) -> f64

Compute the excess kurtosis.

impl Mean for Categorical
[src]

fn mean(&self) -> f64

Compute the expected value.

impl Median for Categorical
[src]

fn median(&self) -> f64

Compute the median.

impl Modes for Categorical
[src]

fn modes(&self) -> Vec<usize>

Compute the modes.

impl Sample for Categorical
[src]

fn sample<S>(&self, source: &mut S) -> usize where S: Source

Draw a sample.

impl Skewness for Categorical
[src]

fn skewness(&self) -> f64

Compute the skewness.

impl Variance for Categorical
[src]

fn variance(&self) -> f64

Compute the variance.

fn deviation(&self) -> f64

Compute the standard deviation.

fn var(&self) -> f64

Compute the variance. Read more

fn sd(&self) -> f64

Compute the standard deviation. Read more