[−][src]Trait statrs::statistics::Median
The Median
trait specifies than an object has a closed form solution
for its median
Required methods
fn median(&self) -> T
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]
fn median(&self) -> f64
[src]
Returns the median of the cauchy distribution
Formula
x_0
where x_0
is the location
impl Median<f64> for ChiSquared
[src]
fn median(&self) -> f64
[src]
Returns the median of the chi-squared distribution
Formula
k * (1 - (2 / 9k))^3
impl Median<f64> for DiscreteUniform
[src]
fn median(&self) -> f64
[src]
Returns the median of the discrete uniform distribution
Formula
(max + min) / 2
impl Median<f64> for Exponential
[src]
fn median(&self) -> f64
[src]
Returns the median of the exponential distribution
Formula
(1 / λ) * ln2
where λ
is the rate
impl Median<f64> for Geometric
[src]
impl Median<f64> for LogNormal
[src]
fn median(&self) -> f64
[src]
Returns the median of the log-normal distribution
Formula
e^μ
where μ
is the location
impl Median<f64> for Normal
[src]
fn median(&self) -> f64
[src]
Returns the median of the normal distribution
Formula
μ
where μ
is the mean
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]
fn median(&self) -> f64
[src]
Returns the median of the student's t-distribution
Formula
μ
where μ
is the location
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) }
impl Median<f64> for Uniform
[src]
fn median(&self) -> f64
[src]
Returns the median for the continuous uniform distribution
Formula
(min + max) / 2