Trait statrs::statistics::Median [−][src]
The Median
trait specifies than an object has a closed form solution
for its median
Required methods
fn median(&self) -> T
[src]
Returns the median. May panic depending on the implementor.
Examples
use statrs::statistics::Median; use statrs::distribution::Uniform; let n = Uniform::new(0.0, 1.0).unwrap(); assert_eq!(0.5, n.median());
Implementations on Foreign Types
impl Median<f64> for [f64]
[src]
Loading content...Implementors
impl Median<f64> for Bernoulli
[src]
fn median(&self) -> f64
[src]
Returns the median of the bernoulli distribution
Formula
ⓘ
if p < 0.5 { 0 } else if p > 0.5 { 1 } else { 0.5 }
impl Median<f64> for Binomial
[src]
impl Median<f64> for Categorical
[src]
impl Median<f64> for Cauchy
[src]
impl Median<f64> for ChiSquared
[src]
impl Median<f64> for DiscreteUniform
[src]
impl Median<f64> for Exponential
[src]
impl Median<f64> for Geometric
[src]
impl Median<f64> for LogNormal
[src]
impl Median<f64> for Normal
[src]
impl Median<f64> for Pareto
[src]
fn median(&self) -> f64
[src]
Returns the median of the Pareto distribution
Formula
ⓘ
x_m*2^(1/α)
where x_m
is the scale and α
is the shape
impl Median<f64> for Poisson
[src]
fn median(&self) -> f64
[src]
Returns the median of the poisson distribution
Formula
ⓘ
floor(λ + 1 / 3 - 0.02 / λ)
where λ
is the rate
impl Median<f64> for StudentsT
[src]
impl Median<f64> for Triangular
[src]
fn median(&self) -> f64
[src]
Returns the median of the triangular distribution
Formula
ⓘ
if mode >= (min + max) / 2 { min + sqrt((max - min) * (mode - min) / 2) } else { max - sqrt((max - min) * (max - mode) / 2) }