Struct statrs::distribution::Poisson [−][src]
pub struct Poisson { /* fields omitted */ }
Implements the Poisson distribution
Examples
use statrs::distribution::{Poisson, Discrete}; use statrs::statistics::Mean; use statrs::prec; let n = Poisson::new(1.0).unwrap(); assert_eq!(n.mean(), 1.0); assert!(prec::almost_eq(n.pmf(1), 0.367879441171442, 1e-15));
Implementations
impl Poisson
[src]
impl Poisson
[src]pub fn new(lambda: f64) -> Result<Poisson>
[src]
Constructs a new poisson distribution with a rate (λ)
of lambda
Errors
Returns an error if lambda
is NaN
or lambda <= 0.0
Examples
use statrs::distribution::Poisson; let mut result = Poisson::new(1.0); assert!(result.is_ok()); result = Poisson::new(0.0); assert!(result.is_err());
pub fn lambda(&self) -> f64
[src]
Returns the rate (λ) of the poisson distribution
Examples
use statrs::distribution::Poisson; let n = Poisson::new(1.0).unwrap(); assert_eq!(n.lambda(), 1.0);
Trait Implementations
impl Discrete<u64, f64> for Poisson
[src]
impl Discrete<u64, f64> for Poisson
[src]fn pmf(&self, x: u64) -> f64
[src]
Calculates the probability mass function for the poisson distribution at
x
Formula
ⓘ
(λ^k * e^(-λ)) / x!
where λ
is the rate
fn ln_pmf(&self, x: u64) -> f64
[src]
Calculates the log probability mass function for the poisson
distribution at
x
Formula
ⓘ
ln((λ^k * e^(-λ)) / x!)
where λ
is the rate
impl Distribution<f64> for Poisson
[src]
impl Distribution<f64> for Poisson
[src]impl Univariate<u64, f64> for Poisson
[src]
impl Univariate<u64, f64> for Poisson
[src]