pub struct Gev { /* private fields */ }Expand description
Generalized Extreme Value Distribution Gev(μ, σ, ξ) where the parameters are μ is location σ is the scale ξ is the shape
f(x|μ, σ, ξ) = \frac{1}{σ} t(x)^{ξ + 1} e^{-t(x)}
t(x) = ⎰ (1 + ξ ((x - μ) / σ))^(-1/ξ) if ξ ≠ 0
⎱ e^{(μ - x) / σ} if ξ = 0Implementations§
Source§impl Gev
impl Gev
Sourcepub fn new(loc: f64, scale: f64, shape: f64) -> Result<Self, GevError>
pub fn new(loc: f64, scale: f64, shape: f64) -> Result<Self, GevError>
Create a new Gev distribution with location, scale, and shape.
Sourcepub fn new_unchecked(loc: f64, scale: f64, shape: f64) -> Self
pub fn new_unchecked(loc: f64, scale: f64, shape: f64) -> Self
Creates a new Gev without checking whether the parameters are valid.
Sourcepub fn loc(&self) -> f64
pub fn loc(&self) -> f64
Get the location parameter
§Example
let gev = Gev::new(1.2, 2.3, 3.4).unwrap();
assert_eq!(gev.loc(), 1.2);Sourcepub fn set_loc(&mut self, loc: f64) -> Result<(), GevError>
pub fn set_loc(&mut self, loc: f64) -> Result<(), GevError>
Set the loc parameter without input validation
§Example
let mut gev = Gev::new(1.2, 2.3, 3.4).unwrap();
assert_eq!(gev.loc(), 1.2);
gev.set_loc(2.8).unwrap();
assert_eq!(gev.loc(), 2.8);Will error for invalid values
assert!(gev.set_loc(2.8).is_ok());
assert!(gev.set_loc(f64::INFINITY).is_err());
assert!(gev.set_loc(f64::NEG_INFINITY).is_err());
assert!(gev.set_loc(f64::NAN).is_err());Sourcepub fn set_loc_unchecked(&mut self, loc: f64)
pub fn set_loc_unchecked(&mut self, loc: f64)
Set the loc parameter without input validation
Sourcepub fn shape(&self) -> f64
pub fn shape(&self) -> f64
Get the shape parameter
§Example
let gev = Gev::new(1.2, 2.3, 3.4).unwrap();
assert_eq!(gev.shape(), 3.4);Sourcepub fn set_shape(&mut self, shape: f64) -> Result<(), GevError>
pub fn set_shape(&mut self, shape: f64) -> Result<(), GevError>
Set the shape parameter without input validation
§Example
let mut gev = Gev::new(1.2, 2.3, 3.4).unwrap();
assert_eq!(gev.shape(), 3.4);
gev.set_shape(2.8).unwrap();
assert_eq!(gev.shape(), 2.8);Will error for invalid values
assert!(gev.set_shape(2.8).is_ok());
assert!(gev.set_shape(f64::INFINITY).is_err());
assert!(gev.set_shape(f64::NEG_INFINITY).is_err());
assert!(gev.set_shape(f64::NAN).is_err());Sourcepub fn set_shape_unchecked(&mut self, shape: f64)
pub fn set_shape_unchecked(&mut self, shape: f64)
Set the shape parameter without input validation
Sourcepub fn scale(&self) -> f64
pub fn scale(&self) -> f64
Get the scale parameter
§Example
let gev = Gev::new(1.2, 2.3, 3.4).unwrap();
assert_eq!(gev.scale(), 2.3);Sourcepub fn set_scale(&mut self, scale: f64) -> Result<(), GevError>
pub fn set_scale(&mut self, scale: f64) -> Result<(), GevError>
Set the scale parameter without input validation
§Example
let mut gev = Gev::new(1.2, 2.3, 3.4).unwrap();
assert_eq!(gev.scale(), 2.3);
gev.set_scale(2.8).unwrap();
assert_eq!(gev.scale(), 2.8);Will error for invalid values
assert!(gev.set_scale(2.8).is_ok());
assert!(gev.set_scale(0.0).is_err());
assert!(gev.set_scale(-1.0).is_err());
assert!(gev.set_scale(f64::INFINITY).is_err());
assert!(gev.set_scale(f64::NEG_INFINITY).is_err());
assert!(gev.set_scale(f64::NAN).is_err());Sourcepub fn set_scale_unchecked(&mut self, scale: f64)
pub fn set_scale_unchecked(&mut self, scale: f64)
Set the scale parameter without input validation
Trait Implementations§
Source§impl ContinuousDistr<f32> for Gev
impl ContinuousDistr<f32> for Gev
Source§impl ContinuousDistr<f64> for Gev
impl ContinuousDistr<f64> for Gev
Source§impl<'de> Deserialize<'de> for Gev
impl<'de> Deserialize<'de> for Gev
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl HasDensity<f32> for Gev
impl HasDensity<f32> for Gev
Source§impl HasDensity<f64> for Gev
impl HasDensity<f64> for Gev
Source§impl Parameterized for Gev
impl Parameterized for Gev
type Parameters = GevParameters
fn emit_params(&self) -> Self::Parameters
fn from_params(params: Self::Parameters) -> Self
fn map_params(&self, f: impl Fn(Self::Parameters) -> Self::Parameters) -> Self
Source§impl Sampleable<f32> for Gev
impl Sampleable<f32> for Gev
Source§impl Sampleable<f64> for Gev
impl Sampleable<f64> for Gev
impl StructuralPartialEq for Gev
Auto Trait Implementations§
impl Freeze for Gev
impl RefUnwindSafe for Gev
impl Send for Gev
impl Sync for Gev
impl Unpin for Gev
impl UnwindSafe for Gev
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.