1. Home
  2. Statistics & special functions

Statistics · tail probabilities

F Distribution Tail Probability (ftail)

Eigenfield editorial team ·

A function usually named ftail returns the upper tail probability of the F distribution: for a value f and degrees of freedom d₁ and d₂, it gives P(F > f), the probability that a ratio of two scaled chi-square variables exceeds f. The result is the p-value of a variance-ratio test, of the overall F test in a regression, and of each row in an analysis-of-variance table.

The arguments are easy to swap by accident. The numerator degrees of freedom d₁ come first, the denominator degrees of freedom d₂ second, and the answer is not symmetric in them. The value f = 4 with (3, 10) degrees of freedom has tail probability 0.0413, while the same f with (10, 3) has 0.1404. Check the order against the table or sheet you are reproducing.

What the tail measures

If X has a chi-square distribution with d₁ degrees of freedom and Y one with d₂, independent of X, then F = (X/d₁) / (Y/d₂). The density is zero for negative arguments, rises to a mode below 1 (when d₁ > 2), and has a long right tail. Only the right tail matters for most tests, because a large ratio of variances is the surprising outcome.

The tail is an incomplete beta function in disguise:

P(F > f) = I_x(d₂/2, d₁/2),   x = d₂ / (d₂ + d₁·f)

Here I_x(a, b) is the regularized incomplete beta function. Numerical libraries evaluate it by a continued fraction, the same device described on the page about Lentz’s method. A related function, the incomplete gamma function, plays the same role for the chi-square distribution.

Cases you can check by hand

Two special cases have closed forms and make good tests for any implementation. For d₁ = 2 the tail is P(F > f) = (1 + 2f/d₂)^(−d₂/2). With d₂ = 2 this reduces to 1/(1 + f), so f = 3 gives exactly 0.25. With d₂ = 12 and f = 6 it is (1 + 1)^(−6) = 1/64 = 0.015625.

The general case needs a table or a routine. The classic 5 percent critical value for (3, 10) degrees of freedom is f = 3.708, and a quadrature of the density beyond that point gives 0.0500. Moving to f = 4.0 lowers the tail to 0.0413, and f = 2.0 with (5, 20) degrees of freedom leaves 0.1225.

f d₁ d₂ P(F > f)
3.0 2 2 0.2500
6.0 2 12 0.015625
3.708 3 10 0.0500
4.0 3 10 0.0413
2.0 5 20 0.1225

Swapping the roles of numerator and denominator inverts the argument: P(F > f; d₁, d₂) = P(F < 1/f; d₂, d₁). So the tail at f = 4 for (3, 10) equals the lower-tail probability at 0.25 for (10, 3), which is 0.0413. That identity lets a routine that only handles one orientation serve both.

When d₁ = 1 the F variable is the square of a Student t variable with d₂ degrees of freedom, so P(F > t²) equals the two-sided tail of t. With d₂ = 10, t = 2.228 squares to 4.964, and the F tail there is 0.0500, twice the one-sided value 0.0250 that the t tail function returns. Checking one function against the other is a quick way to catch a transposed argument.

Practical notes

Compute the tail directly rather than as one minus the cumulative probability. For large f the cumulative value rounds to 1 in double precision and the subtraction returns zero or noise, while the upper tail still carries a small but meaningful positive number.

Reject non-positive degrees of freedom and return 1 for f ≤ 0. Non-integer degrees of freedom are valid in the formula and appear in approximations such as Satterthwaite’s, so do not round them silently.

Tail probabilities for the other standard distributions are collected on the statistics and special functions page, and terms such as degrees of freedom are defined in the glossary.

Back to top