Struct bio::stats::probs::cdf::CDF [] [src]

pub struct CDF<T: Ord> {
    // some fields omitted
}

Implementation of a cumulative distribution function.

Methods

impl<T: Ord> CDF<T>
[src]

fn from_pmf(entries: Vec<Entry<T>>) -> Self

Create CDF from given probability mass function (PMF). The PMF may contain duplicate values the probabilities of which are summed during generation of the CDF.

Arguments

  • pmf - the PMF as a vector of Entry objects

fn from_cdf<I: Iterator<Item=Entry<T>>>(entries: I) -> Self

Create CDF from iterator. This can be used to replace the values of a CDF.

fn reduce(self) -> Self

Reduce CDF by omitting values with zero probability.

fn sample(self, n: usize) -> Self

Downsample CDF to n entries. Panics if n <= 1 and returns identity if n is greater than the number of entries.

fn iter(&self) -> Iter<Entry<T>>

Provide iterator.

fn iter_pmf<'a>(&'a self) -> CDFPMFIter<'a, T>

Iterator over corresponding PMF.

fn get(&self, value: &T) -> Option<LogProb>

Get cumulative probability for a given value. If the value is not present, return the probability of the previous value. Complexity O(log n).

fn get_pmf(&self, value: &T) -> Option<LogProb>

Get probability (i.e. probability mass) for a given value. Complexity O(log n).

fn total_prob(&self) -> LogProb

Return total probability.

fn map(&self) -> Option<&T>

Return maximum a posteriori probability estimate (MAP).

fn credible_interval(&self, width: f64) -> Range<&T>

Return w%-credible interval. The width w is a float between 0 and 1. Panics otherwise. E.g. provide width=0.95 for the 95% credible interval.

fn len(&self) -> usize

Number of entries in the CDF.

impl<T: Clone + Ord> CDF<T> where f64: From<T>
[src]

fn expected_value(&self) -> f64

Calculate expected value.

fn variance(&self) -> f64

Calculate variance.

fn standard_deviation(&self) -> f64

Calculate standard deviation.

Trait Implementations

impl<T: Clone + Ord> Clone for CDF<T>
[src]

fn clone(&self) -> CDF<T>

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<T: Debug + Ord> Debug for CDF<T>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.