pub struct Gumbel { /* private fields */ }
Expand description
Implements the Gumbel distribution, also known as the type-I generalized extreme value distribution.
§Examples
use statrs::distribution::{Gumbel, Continuous};
use statrs::{consts::EULER_MASCHERONI, statistics::Distribution};
let n = Gumbel::new(0.0, 1.0).unwrap();
assert_eq!(n.location(), 0.0);
assert_eq!(n.skewness().unwrap(), 1.13955);
assert_eq!(n.pdf(0.0), 0.36787944117144233);
Implementations§
Source§impl Gumbel
impl Gumbel
Sourcepub fn new(location: f64, scale: f64) -> Result<Self, GumbelError>
pub fn new(location: f64, scale: f64) -> Result<Self, GumbelError>
Constructs a new Gumbel distribution with the given location and scale.
§Errors
Returns an error if location or scale are NaN
or scale <= 0.0
§Examples
use statrs::distribution::Gumbel;
let mut result = Gumbel::new(0.0, 1.0);
assert!(result.is_ok());
result = Gumbel::new(0.0, -1.0);
assert!(result.is_err());
Trait Implementations§
Source§impl Continuous<f64, f64> for Gumbel
impl Continuous<f64, f64> for Gumbel
Source§impl ContinuousCDF<f64, f64> for Gumbel
impl ContinuousCDF<f64, f64> for Gumbel
Source§fn cdf(&self, x: f64) -> f64
fn cdf(&self, x: f64) -> f64
Calculates the cumulative distribution function for the
Gumbel distribution at x
§Formula
e^(-e^(-(x - μ) / β))
where μ
is the location and β
is the scale
Source§impl Distribution<f64> for Gumbel
impl Distribution<f64> for Gumbel
Source§impl Distribution<f64> for Gumbel
impl Distribution<f64> for Gumbel
Source§fn entropy(&self) -> Option<f64>
fn entropy(&self) -> Option<f64>
Returns the entropy of the Gumbel distribution
§Formula
ln(β) + γ + 1
where β
is the scale
and γ
is the Euler-Mascheroni constant (approx 0.57721)
Source§fn mean(&self) -> Option<f64>
fn mean(&self) -> Option<f64>
Returns the mean of the Gumbel distribution
§Formula
μ + γβ
where μ
is the location, β
is the scale
and γ
is the Euler-Mascheroni constant (approx 0.57721)
Source§fn skewness(&self) -> Option<f64>
fn skewness(&self) -> Option<f64>
Returns the skewness of the Gumbel distribution
§Formula
12 * sqrt(6) * ζ(3) / π^3 ≈ 1.13955
ζ(3) is the Riemann zeta function evaluated at 3 (approx 1.20206) and π is the constant PI (approx 3.14159)
This approximately evaluates to 1.13955
impl Copy for Gumbel
impl StructuralPartialEq for Gumbel
Auto Trait Implementations§
impl Freeze for Gumbel
impl RefUnwindSafe for Gumbel
impl Send for Gumbel
impl Sync for Gumbel
impl Unpin for Gumbel
impl UnwindSafe for Gumbel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.