[][src]Struct statrs::distribution::Exponential

pub struct Exponential { /* fields omitted */ }

Implements the Exponential distribution and is a special case of the Gamma distribution (referenced here)

Examples

use statrs::distribution::{Exponential, Continuous};
use statrs::statistics::Mean;

let n = Exponential::new(1.0).unwrap();
assert_eq!(n.mean(), 1.0);
assert_eq!(n.pdf(1.0), 0.3678794411714423215955);

Methods

impl Exponential[src]

pub fn new(rate: f64) -> Result<Exponential>[src]

Constructs a new exponential distribution with a rate (λ) of rate.

Errors

Returns an error if rate is NaN or rate <= 0.0

Examples

use statrs::distribution::Exponential;

let mut result = Exponential::new(1.0);
assert!(result.is_ok());

result = Exponential::new(-1.0);
assert!(result.is_err());

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

Returns the rate of the exponential distribution

Examples

use statrs::distribution::Exponential;

let n = Exponential::new(1.0).unwrap();
assert_eq!(n.rate(), 1.0);

Trait Implementations

impl Univariate<f64, f64> for Exponential[src]

fn cdf(&self, x: f64) -> f64[src]

Calculates the cumulative distribution function for the exponential distribution at x

Formula

This example is not tested
1 - e^(-λ * x)

where λ is the rate

impl Continuous<f64, f64> for Exponential[src]

fn pdf(&self, x: f64) -> f64[src]

Calculates the probability density function for the exponential distribution at x

Formula

This example is not tested
λ * e^(-λ * x)

where λ is the rate

fn ln_pdf(&self, x: f64) -> f64[src]

Calculates the log probability density function for the exponential distribution at x

Formula

This example is not tested
ln(λ * e^(-λ * x))

where λ is the rate

impl Min<f64> for Exponential[src]

fn min(&self) -> f64[src]

Returns the minimum value in the domain of the exponential distribution representable by a double precision float

Formula

This example is not tested
0

impl Max<f64> for Exponential[src]

fn max(&self) -> f64[src]

Returns the maximum value in the domain of the exponential distribution representable by a double precision float

Formula

This example is not tested
INF

impl Mean<f64> for Exponential[src]

fn mean(&self) -> f64[src]

Returns the mean of the exponential distribution

Formula

This example is not tested
1 / λ

where λ is the rate

impl Variance<f64> for Exponential[src]

fn variance(&self) -> f64[src]

Returns the variance of the exponential distribution

Formula

This example is not tested
1 / λ^2

where λ is the rate

fn std_dev(&self) -> f64[src]

Returns the standard deviation of the exponential distribution

Formula

This example is not tested
sqrt(1 / λ^2)

where λ is the rate

impl Entropy<f64> for Exponential[src]

fn entropy(&self) -> f64[src]

Returns the entropy of the exponential distribution

Formula

This example is not tested
1 - ln(λ)

where λ is the rate

impl Skewness<f64> for Exponential[src]

fn skewness(&self) -> f64[src]

Returns the skewness of the exponential distribution

Formula

This example is not tested
2

impl Median<f64> for Exponential[src]

fn median(&self) -> f64[src]

Returns the median of the exponential distribution

Formula

This example is not tested
(1 / λ) * ln2

where λ is the rate

impl Mode<f64> for Exponential[src]

fn mode(&self) -> f64[src]

Returns the mode of the exponential distribution

Formula

This example is not tested
0

impl Copy for Exponential[src]

impl Clone for Exponential[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq<Exponential> for Exponential[src]

impl Debug for Exponential[src]

impl Distribution<f64> for Exponential[src]

fn sample_iter<R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T> where
    R: Rng
[src]

Create an iterator that generates random values of T, using rng as the source of randomness. Read more

Auto Trait Implementations

impl Send for Exponential

impl Sync for Exponential

Blanket Implementations

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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