logo

Struct bio::stats::probs::cdf::CDF

source · []
pub struct CDF<T: Ord> { /* private fields */ }
Expand description

Implementation of a cumulative distribution function as a vector of Entrys.

Implementations

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

Runtime complexity: O(n log n), where n is the number of entries.

Arguments
  • entries - The PMF as a vector of Entry objects (values with an associated LogProb).

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

Runtime complexity: O(n), where n is the number of entries.

Arguments
  • entries - An iterator over Entry<T> values, where T requires

Reduce CDF by omitting values with zero probability.

Runtime complexity: O(n), where n is the number of values with prob of zero.

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

Runtime complexity: O(m), where m is the original number of Entrys in CDF.

Arguments
  • n - Number of entries after downsampling.

Provide an iterator for the CDF.

Provide a mutable iterator over entries.

This does not check for consistency. In other words, you should not change the order of the entries, nor the probabilities!

Provide an iterator over the PMF corresponding to this CDF.

Get cumulative probability for a given value.

If the value is not present, return the probability of the previous value. Time complexity: O(log n), where n is the number of Entrys in CDF.

Arguments
  • value - A value at which you’re interested in the cumulative probability.

Get probability (i.e. probability mass) for a given value.

Time complexity: O(log n), where n is the number of Entrys in CDF.

Return total probability of the CDF.

Time complexity: O(1).

Return maximum a posteriori probability estimate (MAP).

Time complexity: O(n), where n is the number of Entrys in CDF.

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.

Runtime complexity: O(log n), where n is the number of Entrys in CDF.

Arguments
  • width - wanted width of the credible interval as a fraction of 1.

Number of Entrys in the CDF.

Time complexity: O(1)

Returns true if a CDF is empty, false otherwise.

Time complexity: O(1)

Calculate expected value.

Runtime complexity: O(n), where n is the number of Entrys in CDF.

Calculate variance.

Runtime complexity: O(n), where n is the number of Entrys in CDF.

Calculate standard deviation.

Runtime complexity: O(n), where n is the number of Entrys in CDF.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.