Exponential Distribution

Table of contents


Density Function

The density function of the Exponential distribution:

\[f(x; \lambda) = \lambda \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.dexp(x: float, rate: float = 1.0, log: bool = False) float

Density function of the Exponential distribution.

Example

>>> pystats.dexp(1.0, 2.0)
0.2706705664732254
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.dexp(x: List[float], rate: float = 1.0, log: bool = False) List[float]

Density function of the Exponential distribution.

Example

>>> pystats.dexp([1.8, 0.7, 4.2], 4.0)
[0.0029863432335067172, 0.24324025050087195, 2.022612539334209e-07]
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 Exponential distribution:

\[\int_0^x f(z; \lambda) dz = 1 - \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.pexp(p: float, rate: float = 1.0, log: bool = False) float

Distribution function of the Exponential distribution.

Example

>>> pystats.pexp(1.0, 2.0)
0.8646647167633873
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.pexp(p: List[float], rate: float = 1.0, log: bool = False) List[float]

Distribution function of the Exponential distribution.

Example

>>> pystats.pexp([1.8, 0.7, 4.2], 4.0)
[0.9992534141916233, 0.9391899373747821, 0.9999999494346865]
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 Exponential distribution:

\[q(p; \lambda) = - \ln (1 - p) / \lambda\]

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

Scalar Input

pystats.qexp(q: float, rate: float = 1.0) float

Quantile function of the Exponential distribution.

Example

>>> pystats.qexp(0.5, 2.0)
0.3465735902799726
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.qexp(q: List[float], rate: float = 1.0) List[float]

Quantile function of the Exponential distribution.

Example

>>> pystats.qexp([0.3, 0.5, 0.8], 4.0)
[0.08916873598468311, 0.1732867951399863, 0.40235947810852524]
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

Random sampling for the Cauchy distribution is achieved via the inverse probability integral transform.

Scalar Output

pystats.rexp(rate: float = 1.0) float

Random sampling function for the Exponential distribution.

Example

>>> pystats.rexp(2.0)
0.8337215251612762
Parameters

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

Returns

A pseudo-random draw from the Exponential distribution.

List Output

pystats.rexp(n: int, rate: float = 1.0) List[float]

Random sampling function for the Exponential distribution.

Example

>>> pystats.rexp(3, 2.0)
[0.006095192297017023, 0.552560396122137, 0.8185248559121117]
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 Exponential distribution.