[][src]Struct rv::dist::Pareto

pub struct Pareto { /* fields omitted */ }

Pareto distribution Pareto(x_m, α) over x in (x_m, ∞).

NOTE: The Pareto distribution is parameterized in terms of shape, α, and scale, x_m.

               α x_m^α
f(x|α, x_m) = ---------
              x^(α + 1)

Implementations

impl Pareto[src]

pub fn new(shape: f64, scale: f64) -> Result<Self, ParetoError>[src]

Create a new Pareto distribution with shape (α) and scale (x_m).

pub fn new_unchecked(shape: f64, scale: f64) -> Self[src]

Creates a new Pareto without checking whether the parameters are valid.

pub fn shape(&self) -> f64[src]

Get shape parameter

Example

let pareto = Pareto::new(1.0, 2.0).unwrap();
assert_eq!(pareto.shape(), 1.0);

pub fn set_shape(&mut self, shape: f64) -> Result<(), ParetoError>[src]

Set the shape parameter

Example

use rv::dist::Pareto;
let mut pareto = Pareto::new(2.0, 1.0).unwrap();
assert_eq!(pareto.shape(), 2.0);

pareto.set_shape(1.1).unwrap();
assert_eq!(pareto.shape(), 1.1);

Will error for invalid values

assert!(pareto.set_shape(1.1).is_ok());
assert!(pareto.set_shape(0.0).is_err());
assert!(pareto.set_shape(-1.0).is_err());
assert!(pareto.set_shape(std::f64::INFINITY).is_err());
assert!(pareto.set_shape(std::f64::NEG_INFINITY).is_err());
assert!(pareto.set_shape(std::f64::NAN).is_err());

pub fn set_shape_unchecked(&mut self, shape: f64)[src]

Set the shape parameter without input validation

pub fn scale(&self) -> f64[src]

Get scale parameter

Example

let pareto = Pareto::new(1.0, 2.0).unwrap();
assert_eq!(pareto.scale(), 2.0);

pub fn set_scale(&mut self, scale: f64) -> Result<(), ParetoError>[src]

Set the scale parameter

Example

use rv::dist::Pareto;
let mut pareto = Pareto::new(2.0, 1.0).unwrap();
assert_eq!(pareto.scale(), 1.0);

pareto.set_scale(1.1).unwrap();
assert_eq!(pareto.scale(), 1.1);

Will error for invalid values

assert!(pareto.set_scale(1.1).is_ok());
assert!(pareto.set_scale(0.0).is_err());
assert!(pareto.set_scale(-1.0).is_err());
assert!(pareto.set_scale(std::f64::INFINITY).is_err());
assert!(pareto.set_scale(std::f64::NEG_INFINITY).is_err());
assert!(pareto.set_scale(std::f64::NAN).is_err());

pub fn set_scale_unchecked(&mut self, scale: f64)[src]

Set the scale parameter without input validation

Trait Implementations

impl Cdf<f32> for Pareto[src]

impl Cdf<f64> for Pareto[src]

impl Clone for Pareto[src]

impl ContinuousDistr<f32> for Pareto[src]

impl ContinuousDistr<f64> for Pareto[src]

impl Debug for Pareto[src]

impl Display for Pareto[src]

impl Entropy for Pareto[src]

impl<'_> From<&'_ Pareto> for String[src]

impl Kurtosis for Pareto[src]

impl Mean<f32> for Pareto[src]

impl Mean<f64> for Pareto[src]

impl Mode<f32> for Pareto[src]

impl Mode<f64> for Pareto[src]

impl PartialEq<Pareto> for Pareto[src]

impl Rv<f32> for Pareto[src]

impl Rv<f64> for Pareto[src]

impl Skewness for Pareto[src]

impl StructuralPartialEq for Pareto[src]

impl Support<f32> for Pareto[src]

impl Support<f64> for Pareto[src]

impl Variance<f64> for Pareto[src]

Auto Trait Implementations

impl RefUnwindSafe for Pareto

impl Send for Pareto

impl Sync for Pareto

impl Unpin for Pareto

impl UnwindSafe for Pareto

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Fx, X> Cdf<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Cdf<X>, 
[src]

impl<Fx, X> ContinuousDistr<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: ContinuousDistr<X>, 
[src]

impl<Fx> Entropy for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Entropy
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<Fx> Kurtosis for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Kurtosis
[src]

impl<Fx, X> Mean<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Mean<X>, 
[src]

impl<Fx, X> Mode<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Mode<X>, 
[src]

impl<Fx, X> Rv<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Rv<X>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<Fx> Skewness for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Skewness
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<Fx, X> Support<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Support<X>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<Fx, X> Variance<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Variance<X>, 
[src]