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§
sourcefn pdf(&self, x: f64) -> f64
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
sourcefn cdf(&self, x: f64) -> f64
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