F Distribution



F Distribution

The distribution function of a random variable X distributed according to the F distribution with ν1 > 0 and ν2 > 0 degrees of freedom is a continuous function, F(x) = P(X < x), given by
F(x) =
0for x < 0
c ∫0x t ν1 / 2 - 1(1 + (ν1 / ν2) t) -(ν1 + ν2) / 2 dt for 0 ≤ x

where c =[ 1 / B(ν1 / 2 ,ν2 / 2 ) ](ν1 / ν2)ν1 / 2 , B(a,b) is the beta function,
B(a,b) = Γ(a) Γ(b) / Γ(a+b).

The corresponding probability density function, f(x) = dF(x)/dx, is
f(x) =
0for x < 0
c x ν1 / 2 - 1(1 + (ν1 / ν2) x) -(ν1 + ν2) / 2 for 0 ≤ x

If both the numerator degrees of freedom, ν1, and the denominator degrees of freedom, ν2, are large, then the random variable
[ X1/3 ( 1 - 2 / 9 ν2 ) - ( 1 - 2 / 9 ν1 ) ] / √[ 2 / 9ν1 + X2/3 2 / 9 ν2 ]
approaches that of a standard normal distribution. The problem of deciding how large n should be depends on the nature of the problem.

If the numerator degrees of freedom, ν1, is not large, then as ν2 → ∞, the distribution of ν1 X approaches that of a Chi-Square distribution with ν1 degrees of freedom.

If the denominator degrees of freedom, ν2, is not large, then as ν1 → ∞, the distribution of ν2 / X approaches that of the complement of a Chi-Square distribution with ν2 degrees of freedom, i.e. P( X < x ) = 1 - P( Z < ν2 / x ), where Z has a Chi-Square distribution with ν2 degrees of freedom.

It should be noted that the convergence to a Chi-Square distribution is slow. The convergence in distribution to a Chi-Square distribution when ν2 is large can easily be shown either by using the Law of Large Numbers and Slutsky's (Slutzky's) theorem or simply taking the limit as ν2 → ∞ of the probability density function.

Function List

  • double F_Distribution( double x, int v1, int v2 )

    This function returns F(x) where F(x) is described above.

  • double F_Density( double x, int v1, int v2 )

    This function returns f(x) where f(x) is described above.

  • void F_Distribution_Tables( int v1, int v2, double start, double delta, int nsteps, double *density, double* distribution_function )

    This function returns f(x) where f(x) is described above in the array density, i.e. density[i] = f(xi) where xi = start + i delta, i = 0,...,nsteps and returns F(x) where F(x) is described above in the array distribution_function, i.e. distribution_function[i] = F(xi) where xi = start + i delta, i = 0,...,nsteps. Note that density must be declared double density[N] where N ≥ nsteps + 1 in the calling routine and similarly the distribution_function must be declared double distribution_function[N] where
    N ≥ nsteps + 1 in the calling routine.

  • double F_Distribution_Large_dofs( double x, int v1, int v2 )

    This function returns the asymptotic distribution of F(x) where both number of degrees of freedom are large.

  • double F_Distribution_Large_Numerator_dof( double x, int v1, int v2 )

    This function returns the asymptotic distribution of F(x) when the numerator degrees of freedom, v1 is large. Note that v1 is assumed to be infinite and is not used in the calculation.

  • double F_Distribution_Large_Denominator_dof( double x, int v1, int v2 )

    This function returns the asymptotic distribution of F(x) when the denominator degrees of freedom, v2 is large. Note that v2 is assumed to be infinite and is not used in the calculation.

Source Code

C source code is available for these routines:

C Test Code, Test Results, and Build Shell Script

  • The file, testfbook.c, contains a test program of F_Distribution( ) and F_Density() written in C. This test program requires the files f_distribution.c, f_density.c, and their dependencies listed above.

  • The file, FDistributionBook.txt, contains the results of the test program testfbook.c.

  • The file, testfbook.sh, contains the shell script used to compile, link, and execute the test program testfbook.c.



  • The file, testfdist.c, contains a test program of F_Distribution( ) written in C. This test program requires the file f_distribution.c and its dependencies listed above.

  • The file, FDistributionTest.txt, contains the results of the test program testfdist.c.

  • The file, testfdist.sh, contains the shell script used to compile, link, and execute the test program testfdist.c.



  • The file, testfdensity.c, contains a test program of F_Density( ) written in C. This test program requires the file f_density.c and its dependencies listed above.

  • The file, FDensityTest.txt, contains the results of the test program testfdensity.c.

  • The file, testfdensity.sh, contains the shell script used to compile, link, and execute the test program testfdensity.c.



  • The file, testftables.c, contains a test program of F_Distribution_Tables( ) written in C. This test program requires the files f_distribution.c, f_density.c, and their dependencies listed above.

  • The file, FTablesTest.txt, contains the results of the test program testftables.c.

  • The file, testftables.sh, contains the shell script used to compile, link, and execute the test program testftables.c.



  • The file, testflargedofs.c, contains a test program of F_Distribution_Large_dofs( ) written in C. This test program requires the files f_distribution_large_dofs.c, f_distribution.c and their dependencies listed above.

  • The file, FDistributionLargedofs.txt, contains the results of the test program testflargedofs.c.

  • The file, testflargedofs.sh, contains the shell script used to compile, link, and execute the test program testflargedofs.c.



  • The file, testflargenumdof.c, contains a test program of F_Distribution_Large_Numerator_dof( ) written in C. This test program requires the files f_distribution_large_numerator_dof.c, f_distribution.c and their dependencies listed above.

  • The file, FDistributionLargeNumeratordof.txt, contains the results of the test program testflargenumdof.c.

  • The file, testflargenumdof.sh, contains the shell script used to compile, link, and execute the test program testflargenumdof.c.



  • The file, testflargedendof.c, contains a test program of F_Distribution_Large_Denominator_dof( ) written in C. This test program requires the files f_distribution_large_denominator_dof.c, f_distribution.c and their dependencies listed above.

  • The file, FDistributionLargeDenominatordof.txt, contains the results of the test program testflargedendof.c.

  • The file, testflargedendof.sh, contains the shell script used to compile, link, and execute the test program testflargedendof.c.