Poisson

Struct Poisson 

Source
pub struct Poisson;
Expand description

A module containing functions to work with the Poisson distribution.

Implementations§

Source§

impl Poisson

Source

pub fn pmf(k: f64, lambda: f64) -> f64

Calculates the Probability Mass Function for the Poisson Distribution.

The Poisson distribution models the probability of a given number of events occurring in a fixed interval of time or space when events occur with a known constant mean rate and are independent.

§Parameters
  • k: The number of events.
  • lambda: The mean rate of events.
§Returns

The value of the PMF at the given k and lambda.

§Example
use numerilib::stats::distr::Poisson;

let k = 7_f64;
let lambda = 8_f64;

let pmf = Poisson::pmf(k, lambda);


println!("PMF at k = {} and lambda = {}: {}", k, lambda, pmf);

Source

pub fn cdf(k: f64, lambda: f64) -> f64

Calculates the Cumulative Distribution Function (CDF) of the Poisson Distribution with the Q Regularized Gamma Function.

The CDF gives the probability that the number of events in the interval is less than or equal to a given value.

§Parameters
  • k: The upper bound for the number of events.
  • lambda: The mean rate of events.
§Returns

The value of the CDF at the given k and lambda.

§Example
use numerilib::stats::distr::Poisson;

let k = 7_f64;
let lambda = 8_f64;

let cdf = Poisson::cdf(k, lambda);

println!("CDF at k = {} and lambda = {}: {}", k, lambda, cdf);

Source

pub fn median(lambda: f64) -> f64

Calculates the median of the Poisson Distribution.

The median is the value that separates the distribution into two halves.

§Parameters
  • lambda: The mean rate of events.
§Returns

The median of the distribution.

§Example
use numerilib::stats::distr::Poisson;

let lambda = 8_f64;

let median = Poisson::median(lambda);

println!("Median with lambda = {}: {}", lambda, median);

Source

pub fn mode(lambda: f64) -> f64

Calculates the mode of the Poisson Distribution.

The mode is the value that appears most frequently in the distribution.

§Parameters
  • lambda: The mean rate of events.
§Returns

The mode of the distribution.

§Example
use numerilib::stats::distr::Poisson;

let lambda = 8_f64;

let mode = Poisson::mode(lambda);

println!("Mode with lambda = {}: {}", lambda, mode);

Source

pub fn sd(lambda: f64) -> f64

Calculates the standard deviation of the Poisson Distribution.

The standard deviation measures the spread of the distribution.

§Parameters
  • lambda: The mean rate of events.
§Returns

The standard deviation of the distribution.

§Example
use numerilib::stats::distr::Poisson;

let lambda = 8_f64;

let sd = Poisson::sd(lambda);

println!("Standard Deviation with lambda = {}: {}", lambda, sd);

Source

pub fn skewness(lambda: f64) -> f64

Calculates the skewness of the Poisson Distribution.

Skewness measures the asymmetry of the distribution.

§Parameters
  • lambda: The mean rate of events.
§Returns

The skewness of the distribution.

§Example
use numerilib::stats::distr::Poisson;

let lambda = 8_f64;

let skewness = Poisson::skewness(lambda);

println!("Skewness with lambda = {}: {}", lambda, skewness);

Source

pub fn kurtosis(lambda: f64) -> f64

Calculates the kurtosis of the Poisson Distribution.

Kurtosis measures the “tailedness” of the distribution.

§Parameters
  • lambda: The mean rate of events.
§Returns

The kurtosis of the distribution.

§Example
use numerilib::stats::distr::Poisson;

let lambda = 8_f64;

let kurtosis = Poisson::kurtosis(lambda);

println!("Kurtosis with lambda = {}: {}", lambda, kurtosis);

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.