Search for probability and statistics terms on Statlect
StatLect

Student's t distribution

by , PhD

The Student's t distribution is a continuous probability distribution that is often encountered in statistics (e.g., in hypothesis tests about the mean).

It arises when a normal random variable is divided by a Chi-square or a Gamma random variable.

Table of Contents

How it arises

Before going into details, we provide an overview.

The standard case

A variable X has a standard Student's t distribution with n degrees of freedom if it can be written as a ratio

[eq1]where:

A Chi-square variable with n degrees of freedom divided by n has a Gamma distribution (with parameters n and $h=1$).

As a consequence, we can also see a standard Student's t distribution with $n $ degrees of freedom as a ratio

[eq2]between a standard normal variable and the square root of a Gamma variable $G $.

The non-standard case

A variable X has a non-standard Student's t distribution if it can be written as a linear transformation of a standard one:[eq3]where Z and $chi _{n}^{2}$ are defined as before.

The distribution is characterized by three parameters:

The standard Student's t distribution

We start from the special case of the standard Student's t distribution.

By first explaining this special case, the exposition of the more general case is greatly facilitated.

Definition

The standard Student's t distribution is characterized as follows.

Definition Let X be a continuous random variable. Let its support be the whole set of real numbers:[eq4]Let [eq5]. We say that X has a standard Student's t distribution with n degrees of freedom if and only if its probability density function is[eq6]where $c$ is a constant:[eq7]and $Bleft( {}
ight) $ is the Beta function.

Usually the number of degrees of freedom is integer ($nin U{2115} $), but it can also be real ([eq5]).

Relation to the normal and to the Gamma distribution

A standard Student's t random variable can be written as a normal random variable whose variance is equal to the reciprocal of a Gamma random variable, as shown by the following proposition.

Proposition The probability density function of X can be written as[eq9]where:

  1. [eq10] is the probability density function of a normal distribution with mean 0 and variance [eq11]:[eq12]

  2. [eq13] is the probability density function of a Gamma random variable with parameters n and $h=1$:[eq14]where[eq15]

Proof

We need to prove that[eq16]where[eq17]and[eq18]Let us start from the integrand function: [eq19]where [eq20]and [eq21] is the probability density function of a random variable having a Gamma distribution with parameters $n+1$ and [eq22]. Therefore:[eq23]

If X is a zero-mean normal random variable with variance $1/g$, conditional on $G=g$, then we can think of X as a ratio[eq24]where Z has a standard normal distribution, $G$ has a Gamma distribution and Z and $G$ are independent.

Expected value

The expected value of a standard Student's t random variable X is well-defined only for $n>1$ and it is equal to[eq25]

Proof

It follows from the fact that the density function is symmetric around 0:[eq26]The above integrals are finite (and so the expected value is well-defined) only if $n>1$ because[eq27]and the above limit is finite only if $n>1$.

Variance

The variance of a standard Student's t random variable X is well-defined only for $n>2$ and it is equal to[eq28]

Proof

It can be derived thanks to the usual variance formula ([eq29]) and to the integral representation of the Beta function:[eq30]From the above derivation, it should be clear that the variance is well-defined only when $n>2$. Otherwise, if $nleq 2$, the above improper integrals do not converge (and the Beta function is not well-defined).

Higher moments

The k-th moment of a standard Student's t random variable X is well-defined only for $k<n$ and it is equal to[eq31]

Proof

By using the definition of moment, we get[eq32]Therefore, to compute the k-th moment and to verify whether it exists and is finite, we need to study the following integral:[eq33]From the above derivation, it should be clear that the k-th moment is well-defined only when $n>k$. Otherwise, if $nleq k$, the above improper integrals do not converge (the integrals involve the Beta function, which is well-defined and converges only when its arguments are strictly positive - in this case only if $frac{n-k}{2}>0$). Therefore, the k-th moment of X is[eq34]

Moment generating function

A standard Student's t random variable X does not possess a moment generating function.

Proof

When a random variable X possesses a moment generating function, then the k-th moment of X exists and is finite for any $kin U{2115} $. But we have proved above that the k-th moment of X exists only for $k<n$. Therefore, X can not have a moment generating function.

Characteristic function

There is no simple expression for the characteristic function of the standard Student's t distribution. It can be expressed in terms of a Modified Bessel function of the second kind (a solution of a certain differential equation, called modified Bessel's differential equation).

The interested reader can consult Sutradhar (1986).

Distribution function

There is no simple formula for the distribution function [eq35] of a standard Student's t random variable X because the integral[eq36]cannot be expressed in terms of elementary functions.

Therefore, it is usually necessary to resort to computer algorithms to compute the values of [eq37].

For example, the MATLAB command:[eq38]returns the value of the distribution function at the point x when the degrees of freedom parameter is equal to n.

Student's t distribution in general

While in the previous section we restricted our attention to the Student's t distribution with zero mean and unit scale, we now deal with the general case.

Definition

The Student's t distribution is characterized as follows.

Definition Let X be a continuous random variable. Let its support be the whole set of real numbers:[eq39]Let $mu in U{211d} $, [eq40] and [eq5]. We say that X has a Student's t distribution with mean mu, scale sigma^2 and n degrees of freedom if and only if its probability density function is[eq42]where $c$ is a constant:[eq7]and $Bleft( {}
ight) $ is the Beta function.

We indicate that X has a t distribution with mean mu, scale parameter sigma^2 and n degrees of freedom by[eq44]

To better understand the Student's t distribution, you can have a look at its density plots.

Relation between standard and general

A random variable X has a t distribution with parameters mu, sigma^2 and n if it is a linear transformation of a standard Student's t random variable.

Proposition If [eq45], then[eq46]where $S$ is a random variable having a standard t distribution.

Proof

Since $sigma $ is strictly positive, [eq47] is a strictly increasing function of $S$. Therefore, we can use the formula for the density of a function of a continuous variable:[eq48]

Expected value

The expected value of a Student's t random variable X is well-defined only for $n>1$ and it is equal to[eq49]

Proof

It is an immediate consequence of the fact that $X=mu +sigma S$ (where $S$ has a standard t distribution) and the linearity of the expected value:[eq50]As we have seen above, [eq51] is well-defined only for $n>1$ and, as a consequence, also [eq52] is well-defined only for $n>1$.

Variance

The variance of a Student's t random variable X is well-defined only for $n>2$ and it is equal to[eq53]

Proof

It can be derived using the formula for the variance of affine transformations on $X=mu +sigma S$ (where $S$ has a standard t distribution):[eq54]As we have seen above, [eq55] is well-defined only for $n>2$ and, as a consequence, also [eq56] is well-defined only for $n>2$.

Moment generating function

A Student's t random variable X does not possess a moment generating function.

Proof

It is a consequence of the fact that $X=mu +sigma S$ (where $S$ has a standard t distribution) and of the fact that a standard Student's t random variable does not possess a moment generating function (see above).

Characteristic function

There is no simple expression for the characteristic function of the Student's t distribution (see the comments above, for the standard case).

Distribution function

As in the case of the standard t distribution (see above), there is no simple formula for the distribution function [eq37] of a Student's t random variable X.

As a consequence, it is usually necessary to resort to computer algorithms to compute the values of [eq37].

Most computer programs provide only routines for the computation of the standard t distribution function (denote it by [eq59]).

In these cases we need to make a conversion, as follows:[eq60]For example, the MATLAB command:[eq61]returns the value at the point x of the distribution function of a Student's t random variable with mean mu, scale sigma and n degrees of freedom.

More details

The following sections contain more details about the t distribution.

Convergence to the normal distribution

A Student's t distribution with mean mu, scale parameter sigma^2 and n degrees of freedom converges in distribution to a normal distribution with mean mu and variance sigma^2 when the number of degrees of freedom n becomes large (converges to infinity).

Proof

As explained before, if X_n has a t distribution, it can be written as[eq62]where Z is a standard normal random variable, and $chi _{n}^{2}$ is a Chi-square random variable with n degrees of freedom, independent of Z. Moreover, as explained in the lecture on the Chi-square distribution, $chi _{n}^{2}$ can be written as a sum of squares of n independent standard normal random variables [eq63]:[eq64]When n tends to infinity, the ratio[eq65]converges in probability to [eq66], by the Law of Large Numbers. As a consequence, by Slutsky's theorem, X_n converges in distribution to [eq67]which is a normal random variable with mean mu and variance sigma^2.

Non-central t distribution

As discussed above, if Z has a standard normal distribution, $G$ has a Gamma distribution with parameters n and $h=1$ and Z and $G$ are independent, then the random variable X defined as[eq68]has a standard Student's t distribution with n degrees of freedom.

Given the same assumptions on Z and $G$, define a random variable $W$ as follows:[eq69]where $cin U{211d} $ is a constant.

The variable $W$ is said to have a non-central standard Student's t distribution with n degrees of freedom and non-centrality parameter $c$.

We do not discuss the details of this distribution here, but be aware that this distribution is sometimes used in statistical theory (also in elementary problems) and that routines to compute its moments and its distribution function can be found in most statistical software packages.

Density plots

This section shows the plots of the densities of some random variables having a t distribution.

The plots help us to understand how the shape of the t distribution changes by changing its parameters.

Plot 1- Changing the mean

The following plot shows two Student's t probability density functions:

By changing only the mean, the shape of the density does not change, but the density is translated to the right (its location changes).

Student's t density plot 1

Plot 2 - Changing the scale

In the following plot:

By changing only the scale parameter, from $sigma =1$ to $sigma =2$, the location of the graph does not change (it remains centered at 0), but the shape of the graph changes (there is less density in the center and more density in the tails).

Student's t density plot 2

Plot 3 - Changing the degrees of freedom

In the following plot:

By changing only the number of degrees of freedom, from $n=5$ to $n=25$, the location of the graph does not change (it remains centered at 0) and its shape changes only marginally (the tails become thinner).

Student's t density plot 3

Solved exercises

Below you can find some exercises with explained solutions.

Exercise 1

Let X_1 be a normal random variable with mean $mu =0$ and variance $sigma ^{2}=4$.

Let X_2 be a Gamma random variable with parameters $n=10$ and $h=3$, independent of X_1.

Find the distribution of the ratio[eq70]

Solution

We can write[eq71]where $Y=X_{1}/2$ has a standard normal distribution and $Z=X_{2}/3$ has a Gamma distribution with parameters $n=10$ and $h=1$. Therefore, the ratio[eq72]has a standard Student's t distribution with $n=10$ degrees of freedom and $X $ has a Student's t distribution with mean $mu =0$, scale $sigma ^{2}=4/3 $ and $n=10$ degrees of freedom.

Exercise 2

Let X_1 be a normal random variable with mean $mu =3$ and variance $sigma ^{2}=1$.

Let X_2 be a Gamma random variable with parameters $n=15$ and $h=2$, independent of X_1.

Find the distribution of the random variable[eq73]

Solution

We can write[eq74]where $Y=X_{1}-3$ has a standard normal distribution and $Z=X_{2}/2$ has a Gamma distribution with parameters $n=15$ and $h=1$. Therefore, the ratio[eq75]has a standard Stutent's t distribution with $n=15$ degrees of freedom.

Exercise 3

Let X be a Student's t random variable with mean $mu =1$, scale $sigma ^{2}=4$ and $n=6$ degrees of freedom.

Compute[eq76]

Solution

First of all, we need to write the probability in terms of the distribution function of X:[eq77]Then, we express the distribution function of X in terms of the distribution function of a standard Student's t random variable Z with $n=6 $ degrees of freedom:[eq78]so that:[eq79]where the difference [eq80] can be computed with a computer algorithm, for example using the MATLAB command

tcdf(0,6)-tcdf(-1/2,6)

References

Sutradhar, B. C. (1986) On the characteristic function of multivariate Student t-distribution, Canadian Journal of Statistics, 14, 329-337.

How to cite

Please cite as:

Taboga, Marco (2021). "Student's t distribution", Lectures on probability theory and mathematical statistics. Kindle Direct Publishing. Online appendix. https://www.statlect.com/probability-distributions/student-t-distribution.

The books

Most of the learning materials found on this website are now available in a traditional textbook format.