Poisson Distribution

Table of contents


Density Function

The density function of the Poisson distribution:

\[f(x; \lambda) = \dfrac{\lambda^x \exp(-\lambda)}{x!} \times \mathbf{1}[ x \geq 0]\]

Methods for scalar input, as well as for list input, are listed below.

Scalar Input

pystats.dpois(x: float, rate: float, log: bool = False) float

Density function of the Poisson distribution.

Example

>>> pystats.dpois(8, 10.0)
0.11259903214902026
Parameters
  • x (float) – A real-valued input.

  • rate (float) – The rate parameter, a real-valued input.

  • log (bool) – Return the log-density or the true form.

Returns

The density function evaluated at x.

List Input

pystats.dpois(x: List[float], rate: float, log: bool = False) List[float]

Density function of the Poisson distribution.

Example

>>> pystats.dpois([2, 3, 4], 10.0)
[0.0022699964881242435, 0.007566654960414158, 0.01891663740103532]
Parameters
  • x (List[float]) – A standard list input.

  • rate (float) – The rate parameter, a real-valued input.

  • log (bool) – Return the log-density or the true form.

Returns

A list of density values corresponding to the elements of x.


Cumulative Distribution Function

The cumulative distribution function (CDF) of the Poisson distribution:

\[F(x; \lambda) = \sum_{z \leq x} f(z; \lambda) = \exp(-\lambda) \sum_{z \leq x} \dfrac{\lambda^z}{z!} \times \mathbf{1}[ z \geq 0]\]

Methods for scalar input, as well as for list input, are listed below.

Scalar Input

pystats.ppois(p: float, rate: float, log: bool = False) float

Distribution function of the Poisson distribution.

Example

>>> pystats.ppois(8, 10.0)
0.3328196787507189
Parameters
  • p (float) – A real-valued input.

  • rate (float) – The rate parameter, a real-valued input.

  • log (bool) – Return the log-density or the true form.

Returns

The cumulative distribution function evaluated at p.

List Input

pystats.ppois(p: List[float], rate: float, log: bool = False) List[float]

Distribution function of the Poisson distribution.

Example

>>> pystats.ppois([2, 3, 4], 10.0)
[0.0027693957155115762, 0.010336050675925718, 0.029252688076961075]
Parameters
  • p (List[float]) – A standard list input.

  • rate (float) – The rate parameter, a real-valued input.

  • log (bool) – Return the log-density or the true form.

Returns

A list of CDF values corresponding to the elements of p.


Quantile Function

The quantile function of the Poisson distribution:

\[q(p; \lambda) = \inf \left\{ x : p \leq F(x; \lambda) \right\}\]

Methods for scalar input, as well as for list input, are listed below.

Scalar Input

pystats.qpois(q: float, rate: float) float

Quantile function of the Poisson distribution.

Example

>>> pystats.qpois(0.9, 10.0)
14.0
Parameters
  • q (float) – A real-valued input.

  • rate (float) – The rate parameter, a real-valued input.

Returns

The quantile function evaluated at q.

List Input

pystats.qpois(q: List[float], rate: float) List[float]

Quantile function of the Poisson distribution.

Example

>>> pystats.qpois([0.3, 0.5, 0.8], 10.0)
[8.0, 10.0, 13.0]
Parameters
  • q (List[float]) – A standard list input.

  • rate (float) – The rate parameter, a real-valued input.

Returns

A list of quantiles values corresponding to the elements of q.


Random Sampling

Scalar Output

pystats.rpois(rate: float) float

Random sampling function for the Poisson distribution.

Example

>>> pystats.rpois(10.0)
7.0
Parameters

rate (float) – The rate parameter, a real-valued input.

Returns

A pseudo-random draw from the Poisson distribution.

List Output

pystats.rpois(n: int, rate: float) List[float]

Random sampling function for the Poisson distribution.

Example

>>> pystats.rpois(4, 10.0)
[11.0, 8.0, 8.0, 9.0]
Parameters
  • n (int) – The number of output values.

  • rate (float) – The rate parameter, a real-valued input.

Returns

A list of pseudo-random draws from the Poisson distribution.