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]
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 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]
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 Distribution<f64> for Exponential
[src]
impl Distribution<f64> for Exponential
[src]impl Entropy<f64> for Exponential
[src]
impl Entropy<f64> for Exponential
[src]impl Max<f64> for Exponential
[src]
impl Max<f64> for Exponential
[src]impl Mean<f64> for Exponential
[src]
impl Mean<f64> for Exponential
[src]impl Median<f64> for Exponential
[src]
impl Median<f64> for Exponential
[src]impl Min<f64> for Exponential
[src]
impl Min<f64> for Exponential
[src]impl Mode<f64> for Exponential
[src]
impl Mode<f64> for Exponential
[src]impl PartialEq<Exponential> 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 Skewness<f64> for Exponential
[src]impl Univariate<f64, f64> for Exponential
[src]
impl Univariate<f64, f64> for Exponential
[src]impl Variance<f64> for Exponential
[src]
impl Variance<f64> for Exponential
[src]