1. Home
  2. Statistics & special functions

Statistics · t distribution

Student t Tail Probability (ttail)

Eigenfield editorial team ·

A t tail function takes a value t and a number of degrees of freedom ν and returns P(T > t), the probability that a Student t variable lies above t. It is what turns a t statistic into a p-value: a one-sided test uses the number directly, a two-sided test doubles it for positive t.

The density looks like the normal bell curve with heavier tails. At ν = 1 it is the Cauchy distribution, and as ν grows it approaches the standard normal. The practical consequence shows up in the tail: a statistic of 2.0 is unremarkable with 5 degrees of freedom and fairly rare with 30.

Definition

The density is f(t) = Γ((ν+1)/2) / (√(νπ) · Γ(ν/2)) · (1 + t²/ν)^(−(ν+1)/2), and the upper tail is its integral from t to infinity. Integrating directly works as a check but is slow. Production code uses the incomplete beta function instead:

x = ν / (ν + t²)
P(T > t) = ½ · I_x(ν/2, ½)        for t ≥ 0
P(T > t) = 1 − P(T > −t)           for t < 0

The symmetry in the second line means only non-negative arguments need the heavy computation. The same incomplete beta function drives the F distribution tail, and in fact a t variable squared is an F variable with 1 and ν degrees of freedom.

Exact cases

Two degrees-of-freedom values have elementary closed forms, which makes them ideal unit tests.

For ν = 1 the tail is P(T > t) = ½ − arctan(t)/π. At t = 1 that is ½ − (π/4)/π = 0.25 exactly. At t = 2 it is ½ − 1.10715/3.14159 = 0.14758.

For ν = 2 the tail is P(T > t) = ½ · (1 − t / √(2 + t²)). At t = 2 this is ½ · (1 − 2/√6) = ½ · (1 − 0.81650) = 0.09175.

Both formulas also expose how slowly heavy tails decay. For ν = 1 the tail falls only like 1/(πt), so a statistic of 100 still has probability about 0.003.

A check table

The table lists the one-sided tail at t = 2.0 for several degrees of freedom, next to the normal limit. Every row except ν = 1 and 2 was obtained by numerical integration of the density.

ν P(T > 2.0)
1 0.14758
2 0.09175
5 0.05097
10 0.03669
30 0.02731
∞ (normal) 0.02275

Two familiar critical values fall out of the same computation. With ν = 10, the point t = 2.228 leaves 0.0250 in the upper tail, so the two-sided 5 percent test rejects beyond ±2.228. With ν = 5 the corresponding point is 2.571. Both are larger than the normal value 1.960, which is the price of estimating the variance from few observations.

Implementation notes

Evaluate the upper tail directly. Computing 1 − cdf loses every digit once the tail drops below about 10⁻¹⁶, and extreme tails matter when a p-value is later adjusted for many comparisons.

Accept non-integer ν, since pooled-variance corrections produce fractional degrees of freedom. Reject ν ≤ 0. For very large ν, fall back on the normal distribution: the normal density and its tail are cheaper and agree to several digits once ν exceeds a few hundred.

The reverse problem, finding the t that corresponds to a chosen tail probability, is solved by Newton iteration on this function. The same idea for the normal case is worked through on the inverse normal distribution page. Other distribution functions are gathered under statistics and special functions.

A last point on testing. Compare the output against both closed forms above and against the normal limit at a large ν, and confirm that P(T > 0) equals one half for every ν. Those four checks catch most transposed arguments and sign errors.

Back to top