pub trait Quantiles: Distribution {
// Provided methods
fn quantile(&self, p: Probability) -> f64 { ... }
fn cquantile(&self, p: Probability) -> f64 { ... }
fn lower_quartile(&self) -> f64 { ... }
fn median(&self) -> f64 { ... }
fn upper_quartile(&self) -> f64 { ... }
fn iqr(&self) -> f64 { ... }
fn lower_fence(&self) -> f64 { ... }
fn upper_fence(&self) -> f64 { ... }
}
Provided Methods§
Sourcefn quantile(&self, p: Probability) -> f64
fn quantile(&self, p: Probability) -> f64
Evaluates the inverse cumulative distribution function (CDF) at p
.
The quantile function specifies the value x
of a random variable X
at which the probability is less than or equal to p
: Q(p) = inf{ x in R : p <= F(x)}
. For continuous and strictly monotonically
increasing CDFs, it takes the exact form: Q = 1 / F
.
Sourcefn cquantile(&self, p: Probability) -> f64
fn cquantile(&self, p: Probability) -> f64
Evaluates the complementary quantile function at x
: Q(1 - p)
.
Sourcefn lower_quartile(&self) -> f64
fn lower_quartile(&self) -> f64
Computes the lower quartile of the distribution, Q(0.25)
.
Sourcefn median(&self) -> f64
fn median(&self) -> f64
Computes the median value of the distribution, Q(0.5)
.
A default implementation is provided by calling self.quantile(0.5)
. It
is recommended, however, that you provide specialised version as it
is generally more efficient than evaluating Q
.
Sourcefn upper_quartile(&self) -> f64
fn upper_quartile(&self) -> f64
Computes the upper quartile of the distribution, Q(0.75)
.
Sourcefn iqr(&self) -> f64
fn iqr(&self) -> f64
Computes the interquartile range (IQR) of the distribution, Q(0.75) - Q(0.25)
.
Sourcefn lower_fence(&self) -> f64
fn lower_fence(&self) -> f64
Computes the lower fence of the distribution, Q(0.25) - 1.5 · IQR
.
The lower fence is typically used to define the lower limit of the distribution, beyond which values are deemed outliers.
Sourcefn upper_fence(&self) -> f64
fn upper_fence(&self) -> f64
Computes the lower fence of the distribution, Q(0.75) + 1.5 · IQR
.
The upper fence is typically used to define the upper limit of the distribution, beyond which values are deemed outliers.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.