Trait russell_stat::ProbabilityDistribution

source ·
pub trait ProbabilityDistribution {
    // Required methods
    fn pdf(&self, x: f64) -> f64;
    fn cdf(&self, x: f64) -> f64;
    fn mean(&self) -> f64;
    fn variance(&self) -> f64;
    fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> f64;
}
Expand description

Defines the Probability Distribution trait

Required Methods§

source

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

Evaluates the Probability Density Function (PDF)

The probability density function f(x) is such that (see Eq 9 on page 1033 of the Reference):

                b
               ⌠
P(a < X ≤ b) = │ f(v) dv = F(b) - F(a)
               ⌡
              a

with b > a

where X is the continuous random variable, P(a < X ≤ b) is the probability that X is in the semi-open interval (a, b], and F(x) is the cumulative probability distribution (CDF).

Note that, for continuous random variables, the following probabilities are all the same (page 1033 of the reference):

prob = P(a < X < b)
     = P(a < X ≤ b)
     = P(a ≤ X < b)
     = P(a ≤ X ≤ b)
§References
  • Kreyszig, E (2011) Advanced engineering mathematics; in collaboration with Kreyszig H, Edward JN 10th ed 2011, Hoboken, New Jersey, Wiley
source

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

Evaluates the Cumulative Distribution Function (CDF)

The cumulative distribution function (or simply distribution) F(x) is such that (see Eq 1 on page 1029 of the Reference):

            x
           ⌠
P(X ≤ x) = │ f(v) dv = F(x)
           ⌡
         -∞

where X is the continuous random variable, P(X ≤ x) is the probability that X assumes values not exceeding x, and f(x) is the probability density function (PDF).

§References
  • Kreyszig, E (2011) Advanced engineering mathematics; in collaboration with Kreyszig H, Edward JN 10th ed 2011, Hoboken, New Jersey, Wiley
source

fn mean(&self) -> f64

Returns the Mean

source

fn variance(&self) -> f64

Returns the Variance

source

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> f64

Generates a pseudo-random number belonging to this probability distribution

Object Safety§

This trait is not object safe.

Implementors§