Logistic Distribution

Table of contents


Density Function

The density function of the Logistic distribution:

\[f(x; \mu, \sigma) = \dfrac{\exp\left( - \frac{x-\mu}{\sigma} \right)}{\sigma \left( 1 + \exp\left( - \frac{x-\mu}{\sigma} \right) \right)^2 }\]

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

Scalar Input

pystats.dlogis(x: float, mu: float = 0.0, sigma: float = 1.0, log: bool = False) float

Density function of the Logistic distribution.

Example

>>> pystats.dlogis(2.0, 1.0, 2.0)
0.11750185610079714
Parameters
  • x (float) – A real-valued input.

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

  • sigma (float) – The scale 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.dlogis(x: List[float], mu: float = 0.0, sigma: float = 1.0, log: bool = False) List[float]

Density function of the Logistic distribution.

Example

>>> pystats.dlogis([0.0, 1.0, 2.0], 1.0, 2.0)
[0.11750185610079714, 0.125, 0.11750185610079714]
Parameters
  • x (List[float]) – A standard list input.

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

  • sigma (float) – The scale 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 Logistic distribution:

\[F(x; \mu, \sigma) = \int_{-\infty}^x f(z; \mu, \sigma) dz = \dfrac{1}{1 + \exp \left( - \frac{x-\mu}{\sigma} \right) }\]

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

Scalar Input

pystats.plogis(p: float, mu: float = 0.0, sigma: float = 1.0, log: bool = False) float

Distribution function of the Logistic distribution.

Example

>>> pystats.plogis(2.0, 1.0, 2.0)
0.6224593312018546
Parameters
  • p (float) – A real-valued input.

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

  • sigma (float) – The scale 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.plogis(p: List[float], mu: float = 0.0, sigma: float = 1.0, log: bool = False) List[float]

Distribution function of the Logistic distribution.

Example

>>> pystats.plogis([0.0, 1.0, 2.0], 1.0, 2.0)
[0.37754066879814546, 0.5, 0.6224593312018546]
Parameters
  • p (List[float]) – A standard list input.

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

  • sigma (float) – The scale 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 Logistic distribution:

\[q(p; \mu, \sigma) = \mu + \sigma \times \ln \left( \frac{p}{1-p} \right)\]

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

Scalar Input

pystats.qlogis(q: float, mu: float = 0.0, sigma: float = 1.0) float

Quantile function of the Logistic distribution.

Example

>>> pystats.qlogis(0.75, 1.0, 2.0)
3.1972245773362196
Parameters
  • q (float) – A real-valued input.

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

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

Returns

The quantile function evaluated at q.

List Input

pystats.qlogis(q: List[float], mu: float = 0.0, sigma: float = 1.0) List[float]

Quantile function of the Logistic distribution.

Example

>>> pystats.qlogis([0.1, 0.3, 0.7], 1.0, 2.0)
[-3.394449154672439, -0.6945957207744073, 2.694595720774407]
Parameters
  • q (List[float]) – A standard list input.

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

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

Returns

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


Random Sampling

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

Scalar Output

pystats.rlogis(mu: float = 0.0, sigma: float = 1.0) float

Random sampling function for the Logistic distribution.

Example

>>> pystats.rlogis(1.0, 2.0)
-2.0430312686217516
Parameters
  • mu (float) – The location parameter, a real-valued input.

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

Returns

A pseudo-random draw from the Logistic distribution.

List Output

pystats.rlogis(n: int, mu: float = 0.0, sigma: float = 1.0) List[float]

Random sampling function for the Logistic distribution.

Example

>>> pystats.rlogis(3, 1.0, 2.0)
[7.012051380112511, 1.4135266403017916, -1.3985463825344762]
Parameters
  • n (int) – The number of output values.

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

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

Returns

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