Plotting Student’s t-distribusion

Hiroaki Kubo
2 min readNov 18, 2023

--

We have seen that the conjugate prior of the precision parameter of the Gaussian distribution is the gamma distribution; placing it on a one-variable Gaussian distribution N(xμ,τ−1), taking the gamma distribution Gam(τa,b) as the prior of precision, from which, with integral elimination of precision and substitution of the variablez=τ[b+(xu)2/2], the peripheral distribution of x becomes

Conveniently, if we define new parameters for ν=2a and λ=a/b, the distribution p(xμ,a,b) becomes

This is known as Student’s t-distribution. The parameter λ is also called the precision of the t-distribution, but not necessarily the inverse of the variance. The parameter ν is called the degrees of freedom. For ν=1, the distribution is Cauchy distribution. On the other hand, in the limit of ν, the distribution is Gaussian with mean μ and precision λ.

From Eq(1), we see that the Student’s t-distribution is the sum of an infinite number of Gaussian distributions such that the means are the same but the precision is different. This can be interpreted as an infinite mixture of Gaussian distributions. Also, this distribution generally has a longer distributional shank than the Gaussian distribution. Therefore, the t-distribution has an important property called robustness. This means that even if there are a small number of data points that are outliers, the t-distribution is less affected by them than the Gaussian distribution.

In the following figure, You can see that the Gaussian distribution is more affected by outliers and has a longer tail.

You can draw the above Student’s t-distribution by running this code.

--

--

Hiroaki Kubo

Computer vision engineer. 3D computer vision/ Machine learning / Optimization / Graphics, https://www.linkedin.com/in/hiroaki-kubo-2819951ba/