# Calculating the "critical value" for F test

I'm following along here: http://reliawiki.org/index.php/Multiple_Linear_Regression_Analysis#Calculation_of_the_Statistic

I've successfully made all of the calculations up to $f_0=211.9$. Now I need to calculate $f_{\alpha, k, n-(k+1)}$. On the page, this is simply given as:

The critical value for this test, corresponding to a significance level of 0.1, is:


$$f_{\alpha, k, n-(k+1)} = f_{0.1, 2, 14} = 2.726$$

I understand that $n$ is the number of observations and $k$ is the degrees of freedom. But, how is this number, $2.726$, calculated?

[[Edit: more questions]]

Is this value the result of the CDF for the F-distribution?:

$$F(x; d_1, d_2) = I_{\frac{d_1x}{d_1x+d_2}}(\frac{d_1}{2}, \frac{d_2}{2})$$

Where $x$ is $0.1$, $d_1$ is $2$ an $d_2$ is $14$? and $I$ is:

$$I_v(a,b) = \frac{B(v; a, b)}{B(a, b)}$$

And $B$ is:

$$B(v; a, b) = \int_{0}^{v}t^{a-1}(1-t)^{b-1}dt$$

and

$$B(a, b) = \int_{0}^{1}t^{a-1}(1-t)^{b-1}dt$$

• I'm not sure if you're asking how to find it out, or what the math is. To find it out, you use a program with a function that will calculate it for you. If you want to know the underlying math, the Wikipedia page covers it: en.wikipedia.org/wiki/F-distribution . Feb 13, 2015 at 23:09
• I want to calculate it myself. Feb 13, 2015 at 23:10
• OK, start with the Wikipedia page. It's some heavy maths though. (Or, dig around and find the R code that is used for the function pf()). Feb 13, 2015 at 23:14
• I'm sure that the function can be implemented pretty easily once I have the formula ... digging in ... Feb 14, 2015 at 0:25
• source of pf today: github.com/wch/r-source/blob/… Feb 14, 2015 at 1:05

Some general information:

The calculation of critical values is essentially that of finding tail area of a density or probability function:

This involves finding $x$ that solves the integral equation $\int_x^\infty f(x) dx$.

It used to be that the main way people found these critical values were from tables of the cdf or tail areas (generally combined with interpolation). Nowadays it's mostly done using functions in programs.

When the indefinite integral is doable, this may be easy. Otherwise numerical approximations of various kinds may be invoked, and then some kind of search procedure to find where the tail area is $\alpha$.

Sometimes either the cdf is available which saves the integration step (but not the 'solve' step). Most often, however, the inverse cdf is available either as an algebraic function or as some approximating function, whereupon you just evaluate that function with argument $1-\alpha$:

In the case of the F distribution, one can evaluate the cdf from the incomplete beta function (which is often available in packages of numeric functions), and there's also functions (e.g. ASA 109) that compute approximations to the inverse incomplete beta function, which can be used for finding the inverse cdf.

The result is that in packages you can do something simple like this (here done in R):

 qf(.1,2,14,lower.tail=FALSE)
[1] 2.726468


Is this value the result of the CDF for the F-distribution?:
$F(x; d_1, d_2) = I_{\frac{d_1x}{d_1x+d_2}}(\frac{d_1}{2}, \frac{d_2}{2})$
Where x is 0.1, d1 is 2 an d2 is 14?

No, $F(2.726;2,14)=0.1$; it's $F^{-1}_{2,14}(0.1)$ that is $2.726$

• I think, unfortunately, the implementation of the solution is not so trivial? github.com/wch/r-source/blob/… Feb 14, 2015 at 9:25
• It depends on what you mean by 'trivial'. Usually the underlying formulas aren't so bad, but great care must be taken over numerical accuracy, in detail - and edge cases dealt with carefully. This tends to result in nontrivial code -- which is why people tend to use tried-and-tested algorithms, and even, as far as feasible, avoid rewriting code if there's a suitable existing library with well-tested code. Getting these things accurate and stable can be involved. Feb 14, 2015 at 9:48
• It looks like this is it: github.com/wch/r-source/blob/trunk/src/nmath/toms708.c#L76 Feb 14, 2015 at 21:26
• Note that if your question was actually seeking code, it's pretty likely to be regarded as off topic here. Feb 14, 2015 at 22:44
• I have a follow up question here: stats.stackexchange.com/questions/138959/… Feb 24, 2015 at 1:57