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

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);

Implementations

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 Clone for Exponential[src]

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

λ * 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

ln(λ * e^(-λ * x))

where λ is the rate

impl Copy for Exponential[src]

impl Debug for Exponential[src]

impl Distribution<f64> for Exponential[src]

impl Entropy<f64> for Exponential[src]

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

Returns the entropy of the exponential distribution

Formula

1 - ln(λ)

where λ is the rate

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

INF

impl Mean<f64> for Exponential[src]

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

Returns the mean of the exponential distribution

Formula

1 / λ

where λ is the rate

impl Median<f64> for Exponential[src]

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

Returns the median of the exponential distribution

Formula

(1 / λ) * ln2

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

0

impl Mode<f64> for Exponential[src]

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

Returns the mode of the exponential distribution

Formula

0

impl PartialEq<Exponential> for Exponential[src]

impl Skewness<f64> for Exponential[src]

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

Returns the skewness of the exponential distribution

Formula

2

impl StructuralPartialEq for Exponential[src]

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

1 - e^(-λ * x)

where λ is the rate

impl Variance<f64> for Exponential[src]

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

Returns the variance of the exponential distribution

Formula

1 / λ^2

where λ is the rate

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

Returns the standard deviation of the exponential distribution

Formula

sqrt(1 / λ^2)

where λ is the rate

Auto Trait Implementations

impl RefUnwindSafe for Exponential

impl Send for Exponential

impl Sync for Exponential

impl Unpin for Exponential

impl UnwindSafe for Exponential

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<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<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<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]