Struct statrs::distribution::Exponential [−][src]
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]
fn clone(&self) -> Exponential
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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]
fn sample<R: Rng + ?Sized>(&self, r: &mut R) -> f64
[src]
pub fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
[src]
R: Rng,
impl Entropy<f64> for Exponential
[src]
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]
impl Median<f64> for Exponential
[src]
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]
impl PartialEq<Exponential> for Exponential
[src]
fn eq(&self, other: &Exponential) -> bool
[src]
fn ne(&self, other: &Exponential) -> bool
[src]
impl Skewness<f64> for Exponential
[src]
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]
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,