[−][src]Struct statrs::distribution::Poisson
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));
Methods
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 Univariate<u64, f64> for Poisson
[src]
fn cdf(&self, x: f64) -> f64
[src]
Calculates the cumulative distribution function for the poisson
distribution at x
Formula
1 - P(x + 1, λ)
where λ
is the rate and P
is the lower regularized gamma function
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 Min<u64> for Poisson
[src]
fn min(&self) -> u64
[src]
Returns the minimum value in the domain of the poisson distribution representable by a 64-bit integer
Formula
0
impl Max<u64> for Poisson
[src]
fn max(&self) -> u64
[src]
Returns the maximum value in the domain of the poisson distribution representable by a 64-bit integer
Formula
2^63 - 1
impl Mean<f64> for Poisson
[src]
fn mean(&self) -> f64
[src]
Returns the mean of the poisson distribution
Formula
λ
where λ
is the rate
impl Variance<f64> for Poisson
[src]
fn variance(&self) -> f64
[src]
Returns the variance of the poisson distribution
Formula
λ
where λ
is the rate
fn std_dev(&self) -> f64
[src]
Returns the standard deviation of the poisson distribution
Formula
sqrt(λ)
where λ
is the rate
impl Entropy<f64> for Poisson
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the poisson distribution
Formula
(1 / 2) * ln(2πeλ) - 1 / (12λ) - 1 / (24λ^2) - 19 / (360λ^3)
where λ
is the rate
impl Skewness<f64> for Poisson
[src]
fn skewness(&self) -> f64
[src]
Returns the skewness of the poisson distribution
Formula
λ^(-1/2)
where λ
is the rate
impl Median<f64> for Poisson
[src]
fn median(&self) -> f64
[src]
Returns the median of the poisson distribution
Formula
floor(λ + 1 / 3 - 0.02 / λ)
where λ
is the rate
impl Mode<u64> for Poisson
[src]
fn mode(&self) -> u64
[src]
Returns the mode of the poisson distribution
Formula
floor(λ)
where λ
is the rate
impl Copy for Poisson
[src]
impl Clone for Poisson
[src]
fn clone(&self) -> Poisson
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<Poisson> for Poisson
[src]
impl Debug for Poisson
[src]
impl Distribution<f64> for Poisson
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,