Boost: Student \(t\) (Pearson Type VII) distribution#

The following functions return the pdf, cdf, qtf or boost class of the Student t distribution with \(n > 0\) degrees of freedom and the support interval \((-\infty, +\infty)\).

See also Wikipedia [1263], MathWorld [886], BoostMath [75], Ehrhardt [309] (3.9.29).

Ctx.student_t_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 Student t distribution:

\[\text{pdf}(x) = \frac{\Gamma((n+1)/2)}{\sqrt{n\pi}\Gamma(n/2)} \left(\frac{n}{n+t^2}\right)^{(n+1)/2}.\]

The following example shows both forms of the syntax:

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

Ctx.student_t_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 Student t distribution:

\[\begin{split}\text{cdf}(x) =\begin{cases} 1-p, & x > 0,\\ p & x \le 0. \end{cases}, \quad \text{where } p =\begin{cases} \text{ibeta}(n/2, 1/2, n/(n+x^2))/2, & n < 2x^2,\\ \text{ibetac}(1/2, n/2, x^2/(n+x^2))/2, & n \ge 2x^2. \end{cases}\end{split}\]

Here \(\text{ibeta}(\cdot)\) denotes the real normalised incomplete beta function (RealIBeta), and \(\text{ibetac}(\cdot)\) denotes the real normalised complementary incomplete beta function (RealIBetac).

The following example shows both forms of the syntax:

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

Ctx.student_t_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 Student t distribution:

\[\text{qtf}(q) = t_{\nu, \alpha} = \text{sign}(q-0.5) \sqrt{n (1-x)/x}, \quad \text{where } x = \mathrm{ibeta\_inv}\left(\tfrac{1}{2} n, \tfrac{1}{2}, 2 \cdot \text{min}(q, 1-q)\right).\]

Here \(\mathrm{ibeta\_inv}(\cdot)\) denotes the inverse of the real normalised incomplete beta function (RealIBetaInv).

The following example shows both forms of the syntax:

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

class ctx.dist_student_t(n)#

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

The Student \(t\) distribution is a continuous probability distribution with \(n > 0\) degrees of freedom and the support interval \((-\infty, +\infty)\). See also Wikipedia [1263], MathWorld [886], BoostMath [75], Broda and Paolella [167], Witkovský [1611], Witkovský [1630], R (Statistical System) [553].

See also: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.t.html#scipy.stats.t

See also: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.stdtr.html#scipy.special.stdtr

See also: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.stdtridf.html#scipy.special.stdtridf

See also: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.stdtrit.html#scipy.special.stdtrit

dist_student_t.pdf(x)#

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

\[\text{pdf}_X(x) = \frac{\Gamma((n+1)/2)}{\sqrt{n\pi}\Gamma(n/2)} \left(\frac{n}{n+t^2}\right)^{(n+1)/2}.\]
>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; x = 3;
>>> print ("pdf: ", student_t(mu, sigma).pdf(x))
6.3563523462564525615615615614561356E-20

dist_student_t.cdf(x)#

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

\[\begin{split}\text{cdf}_X(x) =\begin{cases} 1-p, & x > 0,\\ p & x \le 0. \end{cases}, \quad \text{where } p =\begin{cases} \text{ibeta}(n/2, 1/2, n/(n+x^2))/2, & n < 2x^2,\\ \text{ibetac}(1/2, n/2, x^2/(n+x^2))/2, & n \ge 2x^2. \end{cases}\end{split}\]

Here \(\text{ibeta}(\cdot)\) denotes the real normalised incomplete beta function, and \(\text{ibetac}(\cdot)\) denotes the real normalised complementary incomplete beta function.

>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; x = 3;
>>> print ("cdf: ", student_t(mu, sigma).pdf(x))
6.3563523462564525615615615614561356E-20

dist_student_t.sf(x)#

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

\[\text{sf}_X(x) = \text{cdf}_X(-x)\]
>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; x = 3;
>>> print (" sf: ", student_t(mu, sigma).pdf(x))
sf: 6.3563523462564525615615615614561356E-20

dist_student_t.qtf(q)#

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

\[\text{qtf}_X(q) = \text{sign}(q-0.5) \sqrt{n (1-x)/x}, \quad \text{where } x = \mathrm{ibeta\_inv}\left(\tfrac{1}{2} n, \tfrac{1}{2}, 2 \cdot \text{min}(q, 1-q)\right).\]

Here \(\mathrm{ibeta\_inv}(\cdot)\) denotes the inverse of the real normalised incomplete beta function.

>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; q = 0.3;
>>> print ("qtf: ", student_t(mu, sigma).qtf(q))
qtf: 6.3563523462564525615615615614561356E+00

dist_student_t.isf(q)#

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

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

dist_student_t.c_x(t)#

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

\[C_X(t) = \frac{K_{n/2}(\sqrt{n}|t|)^{n/2}}{\Gamma(n/2) 2^{n/2-1}},\]

where \(K_n(\cdot)\) denotes the modified Bessel function of the second kind.

>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; t = 0.3;
>>> print ("c_x: ", student_t(mu, sigma).c_x(t))
6.3563523462564525615615615614561356E+00

dist_student_t.m_x(t)#

Returns NaN, since the moment generating function does not exist.

dist_student_t.k_x(t, k=0)#

Returns NaN, since the cumulant generating function does not exist.

dist_student_t.moments(k)#

Returns the first \(j\) raw moments, \(\mu_j, j = 1 \ldots k\), of a random variable \(X\), following a central Student t distribution. The rth moments only exists for \(n_2 > 2r\).

\[\mu'_X(r) = \mu'_{t}(r)= \left({\tfrac{1}{2}n}\right)^{r/2} \frac{\Gamma\left(\tfrac{1}{2}(n-r)\right)}{\Gamma\left(\tfrac{1}{2}n\right)}.\]
>>> from mpfunlab import *
>>> mp.dps = 30
>>> mu = 0; sigma = 1; k = 6;
>>> print ("saddlepoint: ", student_t(mu, sigma).moments(k))
6.3563523462564525615615615614561356E+00

dist_student_t.cumulants(k)#

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

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