Student-t distribution


Story

The story of the Student-t distribution largely derives from its relationships with other distributions. One way to think about it is as like the Normal distribution with heavier tails.


Parameters

The Student-t distribution is symmetrically peaked, and its peak is located at \(\mu\), the location paramter. The peak’s width is dictated by scale parameter \(\sigma\), which is positive. Finally, the shape parameter, called “degrees of freedom,” is \(\nu\). This last parameter imparts the distribution with heavy tails for small \(\nu\).


Support

The Student-t distribution is supported on the set of real numbers.


Probability density function

\[\begin{align} f(y;\nu, \mu, \sigma) = \frac{\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)\sqrt{\pi \nu \sigma^2}}\left(1 + \frac{(y-\mu)^2}{\nu \sigma^2}\right)^{-\frac{\nu + 1}{2}}, \end{align}\]

where \(\Gamma(x)\) denote a gamma function.


Cumulative distribution function

\[\begin{split}\begin{align} F(y;\nu, \mu, \sigma) = \left\{\begin{array}{lll} \displaystyle{1 - \frac{1}{2}I_{\nu/x^2 + \nu}\left(\frac{\nu}{2}, \frac{1}{2}\right)} & & \text{for }\displaystyle{x = \frac{y-\mu}{\sigma} \le 0},\\[0.5em] \displaystyle{\frac{1}{2}I_{\nu/x^2 + \nu}\left(\frac{\nu}{2}, \frac{1}{2}\right)} & & \text{for }\displaystyle{x = \frac{y-\mu}{\sigma} > 0}, \end{array} \right. \end{align}\end{split}\]

where \(I_x(a, b)\) denotes the regularized incomplete beta function.


Moments

Mean: \(\mu\) for \(\nu > 1\), otherwise undefined.

Variance: \(\displaystyle{\frac{\nu}{\nu - 2}}\,\sigma^2\) for \(\nu > 2\). If \(1 < \nu < 2\), then the variance is infinite. If \(\nu \le 1\), the variance is undefined.


Usage

Package

Syntax

NumPy

mu + sigma * rng.standard_t(nu)

SciPy

scipy.stats.t(nu, mu, sigma)

Stan

student_t(nu, mu, sigma)

Distributions.jl rng

mu .+ sigma .* rand(TDist(nu))

Distributions.jl sampling

x0 ~ TDist(nu); x = mu + sigma * x0



Notes

  • Only the standard Student-t distribution (\(\mu = 0\) and \(\sigma = 1\)) is available in NumPy. You can still draw out of the Student-t distribution by performing a transformation on the samples out of the standard Student-t distribution, as shown in the usage, above. The same is true for Distributions.jl. Shown is an example where \(x\) random numbers are drawn from the distribution and transformed using broadcasting.


PDF and CDF plots