# Find the degrees of freedom of a F distribution given its 97.5th percentile

Let's suppose I have a F distribution $f$ with unknown degrees of freedom $df_{numerator}=df_{denominator}=df$.

If I know the 97.5th percentile $f_{0.975}$ such that $P(f>f_{0.975})=0.025$, is it possible to calculate $df$ in closed form?

For example, given $f_{0.975}=50$, then $df \approx 1.835$. In fact (using Stata)

. di invF(1.835,1.835,0.975)
50.04093


(I found the value $df\approx1.835$ with a loop, but I'd like to avoid doing that).

• As usually defined, F-distributions are not symmetric. What is the density of the distribution you intend? Commented Sep 18, 2014 at 14:30
• Sorry, you're obviously right. I meant an F distribution, with the same dof at the numerator and denominator. Will fix my question immediately. Commented Sep 18, 2014 at 14:31
• I believe it's not doable in closed form in general. Commented Sep 18, 2014 at 15:34
• There is no closed formula. (This is a regularized Beta function. It is an integral over a fixed interval whose integrand depends on $n$ in a fairly complicated way: $n$ appears twice in powers of the variable as well as twice in the normalizing Beta function.) Newton's method for finding roots should work very well for most instances of this problem (except, perhaps, when the value of $0.025$ becomes very small).
– whuber
Commented Sep 18, 2014 at 16:49

I think the simplest possible non-closed-form expression is the following:

Denote $d$ the common degrees of freedom, $F_X(x;d,d)$ the CDF of the F-distribution with common degrees of freedom, and $I$ the regularized beta function.

Then for given $\tilde x$ we have (exploiting some simplifications due to the common degrees of freedom)

$$F_X(\tilde x;d,d) = I_{\frac {\tilde x}{1+\tilde x}}\left(\frac d2,\frac d2\right)=\frac {B\left(\frac {\tilde x}{1+\tilde x};\frac d2,\frac d2\right)}{B\left(\frac d2,\frac d2\right)} = q_1$$

where $B(\cdot \;;\cdot,\cdot)$ is the incomplete beta function and $B(\cdot,\cdot)$ the Beta function.

By the properties of the regularized Beta function we have

$$I_{\frac {\tilde x}{1+\tilde x}}\left(\frac d2,\frac d2\right) = 1- I_{\frac {1}{1+\tilde x}}\left(\frac d2,\frac d2\right) \Rightarrow I_{\frac {1}{1+\tilde x}}\left(\frac d2,\frac d2\right) = 1-q_1 = \frac {B\left(\frac {1}{1+\tilde x};\frac d2,\frac d2\right)}{B\left(\frac d2,\frac d2\right)}$$

Using these two results we have

$$\frac {B\left(\frac {\tilde x}{1+\tilde x};\frac d2,\frac d2\right)}{q_1} = \frac {B\left(\frac {1}{1+\tilde x};\frac d2,\frac d2\right)}{1-q_1}$$

$$\Rightarrow (1-q_1)\int_0^{\frac {\tilde x}{1+\tilde x}}(t-t^2)^{d/2 -1}dt - q_1\int_0^{\frac {1}{1+\tilde x}}(t-t^2)^{d/2 -1}dt = 0$$

...which looks a bit less nightmarish than the picture @whuber's comment describes.

• Alecos, this is exactly what I have described. Please note that the variable is $d$ and that it appears in the powers of the integrands. To find the zeros efficiently (as with Newton's method) you need derivatives. What do you suppose the integrals will look like after you differentiate them with respect to $d$? The integrands will include $\log(d)$ terms.
– whuber
Commented Sep 19, 2014 at 14:51
• @whuber My last sentence refers to the part where you write "$n$ appears twice in powers of the variable as well as twice in the normalizing beta function", not to what will happen next. I just provided explicitly what the equation will look like in the case of common degrees of freedom. Commented Sep 19, 2014 at 16:39
• OK, thanks. It's definitely a simplification (+1). As a technical nicety, the power in the final integrals needs to be $d/2-1$ instead of $d$.
– whuber
Commented Sep 19, 2014 at 17:55
• @whuber Thanks for spotting the mistake. Corrected. Commented Sep 19, 2014 at 18:07