Struct statrs::distribution::Poisson [−][src]
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]
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 Clone for Poisson
[src]
impl Copy for Poisson
[src]
impl Debug 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]
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 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 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]
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 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 Mode<u64> for Poisson
[src]
impl PartialEq<Poisson> for Poisson
[src]
impl Skewness<f64> for Poisson
[src]
impl StructuralPartialEq for Poisson
[src]
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 Variance<f64> for Poisson
[src]
Auto Trait Implementations
impl RefUnwindSafe for Poisson
impl Send for Poisson
impl Sync for Poisson
impl Unpin for Poisson
impl UnwindSafe for Poisson
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>,