# [−][src]Trait statrs::statistics::Mode

The `Mode`

trait specififies that an object has a closed form solution
for its mode(s)

## Required methods

`fn mode(&self) -> T`

Returns the mode. May panic depending on the implementor.

# Examples

use statrs::statistics::Mode; use statrs::distribution::Uniform; let n = Uniform::new(0.0, 1.0).unwrap(); assert_eq!(0.5, n.mode());

## Implementors

`impl Mode<f64> for Beta`

[src]

`fn mode(&self) -> f64`

[src]

Returns the mode of the Beta distribution.

# Remarks

Since the mode is technically only calculate for `α > 1, β > 1`

, those
are the only values we allow. We may consider relaxing this constraint
in
the future.

# Panics

If `α <= 1`

or `β <= 1`

# Formula

(α - 1) / (α + β - 2)

where `α`

is shapeA and `β`

is shapeB

`impl Mode<f64> for Cauchy`

[src]

`fn mode(&self) -> f64`

[src]

Returns the mode of the cauchy distribution

# Formula

`x_0`

where `x_0`

is the location

`impl Mode<f64> for Chi`

[src]

`impl Mode<f64> for ChiSquared`

[src]

`fn mode(&self) -> f64`

[src]

Returns the mode of the chi-squared distribution

# Formula

k - 2

where `k`

is the degrees of freedom

`impl Mode<f64> for Erlang`

[src]

`impl Mode<f64> for Exponential`

[src]

`impl Mode<f64> for FisherSnedecor`

[src]

`impl Mode<f64> for Gamma`

[src]

`impl Mode<f64> for InverseGamma`

[src]

`fn mode(&self) -> f64`

[src]

Returns the mode of the inverse gamma distribution

# Formula

β / (α + 1)

/// where `α`

is the shape and `β`

is the rate

`impl Mode<f64> for LogNormal`

[src]

`fn mode(&self) -> f64`

[src]

Returns the mode of the log-normal distribution

# Formula

e^(μ - σ^2)

where `μ`

is the location and `σ`

is the scale

`impl Mode<f64> for Normal`

[src]

`fn mode(&self) -> f64`

[src]

Returns the mode of the normal distribution

# Formula

`μ`

where `μ`

is the mean

`impl Mode<f64> for Pareto`

[src]

`fn mode(&self) -> f64`

[src]

Returns the mode of the Pareto distribution

# Formula

`x_m`

where `x_m`

is the scale

`impl Mode<f64> for StudentsT`

[src]

`fn mode(&self) -> f64`

[src]

Returns the mode of the student's t-distribution

# Formula

`μ`

where `μ`

is the location

`impl Mode<f64> for Triangular`

[src]

`impl Mode<f64> for Uniform`

[src]

`impl Mode<f64> for Weibull`

[src]

`fn mode(&self) -> f64`

[src]

Returns the median of the weibull distribution

# Formula

if k == 1 { 0 } else { λ((k - 1) / k)^(1 / k) }

where `k`

is the shape and `λ`

is the scale

`impl Mode<i64> for DiscreteUniform`

[src]

`impl Mode<u64> for Bernoulli`

[src]

`fn mode(&self) -> u64`

[src]

Returns the mode of the bernoulli distribution

# Formula

if p < 0.5 { 0 } else { 1 }

`impl Mode<u64> for Binomial`

[src]

`fn mode(&self) -> u64`

[src]

Returns the mode for the binomial distribution

# Formula

floor((n + 1) * p)

`impl Mode<u64> for Geometric`

[src]

`impl Mode<u64> for Hypergeometric`

[src]

`fn mode(&self) -> u64`

[src]

Returns the mode of the hypergeometric distribution

# Formula

floor((n + 1) * (k + 1) / (N + 2))

where `N`

is population, `K`

is successes, and `n`

is draws