Boost: Logistic distribution#

The following functions return the pdf, cdf, qtf or boost class of the logistic distribution with parameters \(a \in \mathbb{R}\) (location), \(b > 0\) (scale), and the support interval \((-\infty, +\infty)\).

See also Wikipedia [1251], MathWorld [902], BoostMath [68], Ehrhardt [309] (3.9.18).

Ctx.logistic_pdf(x, a=0, b=1)#

where Ctx is Math53 or CtxBoost.

Returns \(\text{pdf}(x)\), the value of the probability density function (Pdf) of the logistic distribution:

\[\text{pdf}(x) = \frac{1}{b} \frac{\exp \left(-\frac{x-a}{b}\right)}{\left(1+\exp \left(-\frac{x-a}{b}\right)\right)^2}.\]

The following example shows both forms of the syntax:

>>> from mpfebnet import *
>>> a = 0; b = 1; t = 0.3; x = 0.6;
>>> print ("LogisticPdf(x, a, b): ", LogisticPdf(x, a, b))
>>> print ("dist_logistic(a, b).pdf(x): ", dist_logistic(a, b).pdf(x))
6.3563523462564525615615615614561356E+00

Ctx.logistic_cdf(x, a=0, b=1)#

where Ctx is Math53 or CtxBoost.

Returns \(\text{cdf}(x)\), the value of the cumulative distribution function (Cdf) of the logistic distribution:

\[\text{cdf}(x) = \frac{1}{1+\exp \left(-\frac{x-a}{b}\right)}.\]

The following example shows both forms of the syntax:

>>> from mpfebnet import *
>>> a = 0; b = 1; t = 0.3; x = 0.6;
>>> print ("LogisticCdf(x, a, b): ", LogisticCdf(x, a, b))
>>> print ("dist_logistic(a, b).cdf(x): ", dist_logistic(a, b).cdf(x))
6.3563523462564525615615615614561356E+00

Ctx.logistic_qtf(q, a=0, b=1)#

where Ctx is Math53 or CtxBoost.

Returns \(\text{qtf}(q)\), the value of the quantile function (Qtf) of the logistic distribution:

\[\text{qtf}(q) = a + b \: \log\left( \frac{q}{1-q} \right).\]

The following example shows both forms of the syntax:

>>> from mpfebnet import *
>>> a = 0; b = 1; t = 0.3; q = 0.6;
>>> print ("LogisticQtf(q, a, b): ", LogisticQtf(q, a, b))
>>> print ("dist_logistic(a, b).qtf(q): ", dist_logistic(a, b).qtf(q))
6.3563523462564525615615615614561356E+00

class ctx.dist_logistic(a, b)#

where ctx is fpm, mpm, ipm, dec, gmp or apm.

The logistic distribution is a continuous probability distribution with parameters \(a \in \mathbb{R}\) (location), \(b > 0\) (scale), and the support interval \((-\infty, +\infty)\). See also Wikipedia [1251], MathWorld [902], BoostMath [68].

dist_logistic.pdf(x)#

Returns \(\text{pdf}_X(x)\), the probability density function (pdf) of a random variable \(X\), following an logistic distribution:

\[\text{pdf}_X(x) = \frac{1}{b} \frac{\exp \left(-\frac{x-a}{b}\right)}{\left(1+\exp \left(-\frac{x-a}{b}\right)\right)^2}.\]
>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; x = 3;
>>> print ("pdf: ", logistic(mu, sigma).pdf(x))
6.3563523462564525615615615614561356E-20

dist_logistic.cdf(x)#

Returns \(\text{cdf}_X(x)\), the cumulative distribution function (cdf) of a random variable \(X\), following an logistic distribution:

\[\text{cdf}_X(x) = \frac{1}{1+\exp \left(-\frac{x-a}{b}\right)}.\]
>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; x = 3;
>>> print ("cdf: ", logistic(mu, sigma).pdf(x))
6.3563523462564525615615615614561356E-20

dist_logistic.sf(x)#

Returns \(\text{sf}_X(x)\), the survival function (sf) of a random variable \(X\), following an logistic distribution:

\[\text{sf}_X(x) = \frac{1}{1+\exp \left(\frac{x-a}{b}\right)}.\]
>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; x = 3;
>>> print (" sf: ", logistic(mu, sigma).pdf(x))
sf: 6.3563523462564525615615615614561356E-20

dist_logistic.qtf(q)#

Returns \(\text{qtf}_X(x)\), the quantile function (qtf) of a random variable \(X\), following an logistic distribution:

\[\text{qtf}_X(q) = a + b \: \log\left( \frac{q}{1-q} \right).\]
>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; q = 0.3;
>>> print ("qtf: ", logistic(mu, sigma).qtf(q))
qtf: 6.3563523462564525615615615614561356E+00

dist_logistic.isf(q)#

Returns \(\text{isf}_X(q)\), the inverse survival function (isf) of a random variable \(X\), following an logistic distribution:

\[\text{isf}_X(q) = a - b \: \log\left( \frac{q}{1-q} \right).\]
>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; q = 0.3;
>>> print ("isf: ", logistic(mu, sigma).isf(q))
6.3563523462564525615615615614561356E+00

dist_logistic.c_x(t)#

Returns \(C_X(t)\), the characteristic function of a random variable \(X\), following an logistic distribution:

\[C_X(t) = e^{ita} \frac{\pi b t}{\sinh(\pi b t)}.\]
>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; t = 0.3;
>>> print ("c_x: ", logistic(mu, sigma).c_x(t))
6.3563523462564525615615615614561356E+00

dist_logistic.m_x(t)#

Returns \(M_X(t)\), the moment generating function of a random variable \(X\), following an logistic distribution:

\[M_X(t) = e^{ta} \frac{\pi b t}{\sinh(\pi b t)}.\]
>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; t = 0.3;
>>> print ("m_x: ", logistic(mu, sigma).c_x(t))
6.3563523462564525615615615614561356E+00

dist_logistic.k_x(t, k=0)#

Returns \(K_X(t)\), the cumulant generating function of a random variable \(X\), following an logistic distribution:

\[K_X(t) = ta + \log(\pi b t) - \log(\sinh(\pi b t)).\]
>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; t = 0.3; k = 6;
>>> print ("c_x: ", logistic(mu, sigma).k_x(t, k))
6.3563523462564525615615615614561356E+00

dist_logistic.moments(k)#

Returns the first \(j\) central moments, \(\mu_j, j = 1 \ldots k\), of a random variable \(X\), following an logistic distribution (Wikipedia). The raw moments are calculated from the central moments.

\[\mu_{X}(n) = b^n \pi^n (2^n -2) \cdot |B_n|.\]
>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; k = 6;
>>> print ("saddlepoint: ", logistic(mu, sigma).moments(k))
6.3563523462564525615615615614561356E+00

dist_logistic.cumulants(k)#

Returns the first \(j\) cumulants, \(\kappa_j, j = 1 \ldots k\), of a random variable \(X\), following an logistic distribution. The cumulants are calculated from the moments.

>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; k = 6;
>>> print ("saddlepoint: ", logistic(mu, sigma).cumulants(k))
6.3563523462564525615615615614561356E+00