Derivation of the F-Distribution

English translation of the original Statistics #7 post. Original notation and claims are preserved. Separately labeled scientific notes qualify source errors and assumptions.

This time, we are on the last distribution: the F-distribution.

I think the reason we study the F-distribution after the t-distribution is

that although the statistic T follows a t-distribution, the square of T follows an F-distribution.

Of course, that does not mean it is a distribution followed only by the square of T.

Let us go more general—let’s go!

First, we need to define the random variable F.

Let me just throw this out there first.

Definition of F as (U/r₁)/(V/r₂), where U follows a chi-square distribution with r₁ degrees of freedom,

and V follows a chi-square distribution with r₂ degrees of freedom.

Since we had T = Z / sqrt(U/n), it makes sense that the square of T follows an F-distribution. I will mention this once more at the very end.

And, to throw out the probability density function of the F-distribution first:

Literal introductory source PDF; denominator exponent omitted in original

Of course, this post is about deriving that F-distribution.

Then first, let us construct the joint density function of U and V in Repeated definition of F.

Referring to the chi-square probability density function Chi-square density,

let us call the joint density function of U and V h(u,v).

(The way we construct the joint density function is the same as in the previous derivation of the t-distribution.)

Joint density h(u,v)

And then the cumulative probability distribution.....

I want to write F(~), but that could be confusing,

so here I will use a different notation for the cumulative probability distribution!!!

Cumulative probability

Cumulative probability (statistic ≤ f)

=P⁡ ⁣[U/r1V/r2≤f]=p ⁣[r2r11VU≤f]=p ⁣[U≤r1r2Vf]=\operatorname{P}\!\left[\frac{U/r_1}{V/r_2}\le f\right]=p\!\left[\frac{r_2}{r_1}\frac1V U\le f\right]=p\!\left[U\le\frac{r_1}{r_2}Vf\right]
Untouched native source witnessUntouched original: Cumulative probability

That should do, I guess.

Since Integration region 0<v<∞, 0<u<(r₁/r₂)vf,

from here on, I am going by hand;;;;

Typing this is too much~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Handwritten derivation, first sheet
Whole original handwritten proof, English labels, native formulas and colored arrows preserved
∫0∞ ⁣∫0r1r2vfh(u,v) du dv\int_0^\infty\!\int_0^{\frac{r_1}{r_2}vf}h(u,v)\,du\,dv
=∫0∞ ⁣∫0r1r2vfur12−1vr22−1e−u+v2Γ(r12)Γ(r22)2r1+r22 du dv=\int_0^\infty\!\int_0^{\frac{r_1}{r_2}vf}\frac{u^{\frac{r_1}2-1}v^{\frac{r_2}2-1}e^{-\frac{u+v}2}}{\Gamma(\frac{r_1}2)\Gamma(\frac{r_2}2)2^{\frac{r_1+r_2}2}}\,du\,dv
=1Γ(r12)Γ(r22)2r1+r22∫0∞(∫0r1r2vfur12−1e−u2 du)vr22−1e−v2 dv=\frac1{\Gamma(\frac{r_1}2)\Gamma(\frac{r_2}2)2^{\frac{r_1+r_2}2}}\int_0^\infty\left(\int_0^{\frac{r_1}{r_2}vf}u^{\frac{r_1}2-1}e^{-\frac u2}\,du\right)v^{\frac{r_2}2-1}e^{-\frac v2}\,dv

Let the integrand here be ℓ(u).

=1Γ(r12)Γ(r22)2r1+r22∫0∞(L(r1r2vf)−L(0))vr22−1e−v2 dv=\frac1{\Gamma(\frac{r_1}2)\Gamma(\frac{r_2}2)2^{\frac{r_1+r_2}2}}\int_0^\infty\left(\textcolor{red}{L(\frac{r_1}{r_2}vf)-L(0)}\right)v^{\frac{r_2}2-1}e^{-\frac v2}\,dv

That gets us this far. Differentiate this straight away and move to the probability density function f!

ddf[1Γ(r12)Γ(r22)2r1+r22∫0∞(L(r1r2vf)−L(0))vr22−1e−v2 dv]\textcolor{red}{\frac d{df}}\left[\frac1{\Gamma(\frac{r_1}2)\Gamma(\frac{r_2}2)2^{\frac{r_1+r_2}2}}\int_0^\infty\left(\textcolor{red}{L(\frac{r_1}{r_2}vf)-L(0)}\right)v^{\frac{r_2}2-1}e^{-\frac v2}\,dv\right]
=1Γ(r12)Γ(r22)2r1+r22∫0∞ℓ(r1r2vf)r1r2v⋅vr22−1e−v2 dv=\frac1{\Gamma(\frac{r_1}2)\Gamma(\frac{r_2}2)2^{\frac{r_1+r_2}2}}\int_0^\infty\textcolor{blue}{\ell(\frac{r_1}{r_2}vf)\frac{r_1}{r_2}v}\cdot v^{\frac{r_2}2-1}e^{-\frac v2}\,dv

Earlier, the integrand ℓ(u) was this.

ℓ(u)=ur12−1e−u2\ell(u)=u^{\frac{r_1}2-1}e^{-\frac u2}
=1Γ(r12)Γ(r22)2r1+r22∫0∞(r1r2vf)r12−1e−12(r1r2vf)⋅r1r2v⋅vr22−1e−v2 dv=\frac1{\Gamma(\frac{r_1}2)\Gamma(\frac{r_2}2)2^{\frac{r_1+r_2}2}}\int_0^\infty\textcolor{blue}{(\frac{r_1}{r_2}vf)^{\frac{r_1}2-1}e^{-\frac12(\frac{r_1}{r_2}vf)}}\cdot\frac{r_1}{r_2}v\cdot v^{\frac{r_2}2-1}e^{-\frac v2}\,dv

Just changing the order....

=1Γ(r12)Γ(r22)2r1+r22∫0∞(r1r2)r12⋅vr12fr12−1e−12(r1r2vf)⋅vr22−1e−v2 dv=\frac1{\Gamma(\frac{r_1}2)\Gamma(\frac{r_2}2)2^{\frac{r_1+r_2}2}}\int_0^\infty(\frac{r_1}{r_2})^{\frac{r_1}2}\cdot v^{\frac{r_1}2}f^{\frac{r_1}2-1}e^{-\frac12(\frac{r_1}{r_2}vf)}\cdot v^{\frac{r_2}2-1}e^{-\frac v2}\,dv

The red arrow under the power of r₁/r₂: now take this out to the front.

=(r1r2)r12Γ(r12)Γ(r22)2r1+r22∫0∞fr12−1vr1+r22−1e−12(r1r2vf)−v2 dv=\frac{(\frac{r_1}{r_2})^{\frac{r_1}2}}{\Gamma(\frac{r_1}2)\Gamma(\frac{r_2}2)2^{\frac{r_1+r_2}2}}\int_0^\infty f^{\frac{r_1}2-1}v^{\frac{r_1+r_2}2-1}e^{-\frac12(\frac{r_1}{r_2}vf)-\frac v2}\,dv
=(r1r2)r12Γ(r12)Γ(r22)2r1+r22∫0∞fr12−1vr1+r22−1e−v2(r1r2f+1) dv=\frac{(\frac{r_1}{r_2})^{\frac{r_1}2}}{\Gamma(\frac{r_1}2)\Gamma(\frac{r_2}2)2^{\frac{r_1+r_2}2}}\int_0^\infty f^{\frac{r_1}2-1}v^{\frac{r_1+r_2}2-1}e^{-\frac v2(\frac{r_1}{r_2}f+1)}\,dv

The green box marks the exponent for the substitution.

y=v2(r1r2f+1)⇒{dy=12(r1r2f+1) dvv=2yr1r2f+1dv=2r1r2f+1 dyy=\frac v2(\frac{r_1}{r_2}f+1)\Rightarrow\begin{cases}dy=\frac12(\frac{r_1}{r_2}f+1)\,dv\\v=\frac{2y}{\frac{r_1}{r_2}f+1}\\dv=\frac2{\frac{r_1}{r_2}f+1}\,dy\end{cases}
Untouched native source witnessUntouched original: Handwritten derivation, first sheet
Handwritten derivation, continuation
Whole original handwritten proof, English labels, native formulas and colored arrows preserved
=(r1r2)r12Γ(r12)Γ(r22)2r1+r22∫0∞fr12−1[2yr1r2f+1]r1+r22−1e−y2r1r2f+1 dy=\frac{(\frac{r_1}{r_2})^{\frac{r_1}2}}{\Gamma(\frac{r_1}2)\Gamma(\frac{r_2}2)2^{\frac{r_1+r_2}2}}\int_0^\infty f^{\frac{r_1}2-1}\left[\textcolor{green}{\frac{2y}{\frac{r_1}{r_2}f+1}}\right]^{\frac{r_1+r_2}2-1}e^{-y}\textcolor{green}{\frac2{\frac{r_1}{r_2}f+1}}\,dy

Too many parentheses... let us expand them.

=(r1r2)r12Γ(r12)Γ(r22)2r1+r22∫0∞fr12−12r1+r222−1yr1+r22−1(r1r2f+1)−r1+r22+1e−y⋅2⋅(r1r2f+1)−1 dy=\frac{(\frac{r_1}{r_2})^{\frac{r_1}2}}{\Gamma(\frac{r_1}2)\Gamma(\frac{r_2}2)2^{\frac{r_1+r_2}2}}\int_0^\infty f^{\frac{r_1}2-1}2^{\frac{r_1+r_2}2}2^{-1}y^{\frac{r_1+r_2}2-1}(\frac{r_1}{r_2}f+1)^{-\frac{r_1+r_2}2+1}e^{-y}\cdot2\cdot(\frac{r_1}{r_2}f+1)^{-1}\,dy

The pink arrows take the power of f out to the front.

The red links: the powers of 2 cancel.

The blue links: the factors 2⁻¹ and 2 cancel.

The green links: the +1 and −1 powers cancel.

=(r1r2)r12fr12−1(r1r2f+1)−r1+r22Γ(r12)Γ(r22)∫0∞yr1+r22−1e−y dy=\frac{(\frac{r_1}{r_2})^{\frac{r_1}2}f^{\frac{r_1}2-1}(\frac{r_1}{r_2}f+1)^{-\frac{r_1+r_2}2}}{\Gamma(\frac{r_1}2)\Gamma(\frac{r_2}2)}\int_0^\infty y^{\frac{r_1+r_2}2-1}e^{-y}\,dy

The Gamma function is defined as follows.

Γ(n)=∫0∞xn−1e−x dx\Gamma(n)=\int_0^\infty x^{n-1}e^{-x}\,dx

That is, the red wavy underlined integral is Γ((r₁+r₂)/2).

=Γ(r1+r22)(r1r2)r12fr12−1Γ(r12)Γ(r22)(r1r2f+1)r1+r22=\frac{\Gamma(\frac{r_1+r_2}2)(\frac{r_1}{r_2})^{\frac{r_1}2}f^{\frac{r_1}2-1}}{\Gamma(\frac{r_1}2)\Gamma(\frac{r_2}2)(\frac{r_1}{r_2}f+1)^{\frac{r_1+r_2}2}}
Untouched native source witnessUntouched original: Handwritten derivation, continuation

That finishes the derivation.

Let us just pick up a few basic properties of the F-distribution and wrap this up!!!!

F-distribution definition
U∼χm2,V∼χn2U\sim\chi_m^2,\quad V\sim\chi_n^2

When U and V are independent,

F=U/mV/n∼F(m,n)F=\frac{U/m}{V/n}\sim F(m,n)

we say F follows an F-distribution with degrees of freedom (m,n). Just write ~ F(m,n).

Untouched native source witnessUntouched original: F-distribution definition

Likewise, this distribution has an F-distribution table.

Let us get a little practice reading it.

The F-distribution table denotes the (1−α)-quantile

by Upper-tail quantile notation F alpha m n,

which apparently means this:

P(F > F alpha m n) = alpha

Let us try an example with α = 0.05~

If we look up F 0.05 4 5, it says 5.19.

What this number means,

if we draw it, is

F(4,5): upper-tail probability 5%, source cutoff 5.19
Probability 5%
Untouched native source witnessUntouched original upper-tail sketch

a picture like this!

Another, another, another, another, another property of the F-distribution:

if we switch the denominator and numerator in the definition of the F-distribution, we get an F-distribution with the degrees of freedom switched.

Reciprocal distribution
F∼Fm,n⇒1F∼Fn,mF\sim F_{m,n}\quad\Rightarrow\quad\frac1F\sim F_{n,m}

Let us also remember that this is what happens!

Untouched native source witnessUntouched original: Reciprocal distribution
Reciprocal quantile

Taking the reciprocal of Fα,n,m gives

1Fα,n,m=F1−α,m,n\frac1{F_{\alpha,n,m}}=F_{1-\alpha,m,n}
Untouched native source witnessUntouched original: Reciprocal quantile

So, for example, if we want to know F 0.95 4 5, even without a table for α = 0.95,

we can find it like this as long as we have a table for α = 0.05!

Source reciprocal table calculation (source equality signs retained)
F0.95,4,5=1F0.05,5,4=1read from the table=16.26=0.16F_{0.95,4,5}=\frac1{F_{0.05,5,4}}=\frac1{\text{read from the table}}=\frac1{6.26}=0.16
Untouched native source witnessUntouched original: Source reciprocal table calculation (source equality signs retained)

Then this would be a picture like this.

F(4,5) reciprocal-tail sketch, 0.16 cutoff and 95 percent upper tail

To organize a little more about the F-distribution:

Two normal random samples
X1,X2,⋯ ,Xmfrom N(μ1,σ12)X_1,X_2,\cdots,X_m\quad\text{from }N(\mu_1,\sigma_1^2)

are a random sample of size m, and

Y1,Y2,⋯ ,Ynfrom N(μ2,σ22)Y_1,Y_2,\cdots,Y_n\quad\text{from }N(\mu_2,\sigma_2^2)

are a random sample of size n.

Untouched native source witnessUntouched original: Two normal random samples

The two random samples must also be independent!!!!

Then

the result is Normalized sample-variance ratio.

The idea is simple.

Why the sample-variance degrees are m−1 and n−1
F=S12σ12⋅m−1m−1S22σ22⋅n−1n−1F=\frac{\frac{S_1^2}{\sigma_1^2}\cdot\textcolor{red}{\frac{m-1}{m-1}}}{\frac{S_2^2}{\sigma_2^2}\cdot\textcolor{blue}{\frac{n-1}{n-1}}}

If we transform the expression this way,

(m−1)S12σ12∼χ(m−1)2and(n−1)S22σ22∼χ(n−1)2\frac{(m-1)S_1^2}{\sigma_1^2}\sim\chi_{(m-1)}^2\quad\text{and}\quad\frac{(n-1)S_2^2}{\sigma_2^2}\sim\chi_{(n-1)}^2

we covered these results earlier, so,

(m−1)S12σ12=M,(n−1)S22σ22=N\frac{(m-1)S_1^2}{\sigma_1^2}=M,\quad\frac{(n-1)S_2^2}{\sigma_2^2}=N

if we call these M and N,

F=M/(m−1)N/(n−1)∼F(m−1,n−1)F=\frac{M/(m-1)}{N/(n-1)}\sim F_{(m-1,n-1)}

then that is indeed what F follows.

Untouched native source witnessUntouched original: Why the sample-variance degrees are m−1 and n−1

And way~~~~~~back at the beginning,

for a statistic T that follows a t-distribution,

I said that the square of T follows an F-distribution.

Let us check the degrees of freedom too (although, of course, everyone has already done all~~~of this in their heads.... T.T).

The square of a t statistic
T=ZU/n∼t(n)T=\frac Z{\sqrt{U/n}}\sim t_{(n)}

That was what we had. Then

T2=Z2U/nT^2=\frac{Z^2}{U/n}

is what this says,

Z2∼χ(1)2Z^2\sim\chi_{(1)}^2

which is almost common knowledge by now. Then,

T2=Z2U/n=Z2/1U/n∼F(1,n)T^2=\frac{Z^2}{U/n}=\frac{Z^2/1}{U/n}\sim F_{(1,n)}

written this way, it is clear at a glance!

Untouched native source witnessUntouched original: The square of a t statistic

That was just a summary of the F-distribution.

Now let us talk a little about testing..

r1 = [1, 2, 5, 10, 100]
r2 = [1, 1, 2, 1, 100]
r = list(zip(r1, r2))
 
for i, j in r:                   # i = n
    x = np.linspace(0, 5, 1000)
    y = sc.f(i, j).pdf(x)
    plt.plot(x, y, linewidth=2.0, label = r'$r_1$=%s    $r_2$=%s' % (i, j))
plt.grid(True)
plt.legend()
plt.ylabel('p(x)')
plt.xlabel('x')
plt.ylim(0, 2.5)
plt.title('F Distribution')
plt.savefig('8.F Distribution.jpeg')
Original F distribution plot with five degree pairs

Colored by Color Scripter cs

Comments

Discussion happens via GitHub Discussions. You'll need a GitHub account to comment.