Expand/Contract All

F Distribution

Page Contents

Distribution

If ~X_1 and ~X_2 are two independent chi-squared random variables with ~k_1 and ~k_2 degrees of freedom respectively, then the random variable

~Y _ _ _ _ _ = _ _ _ _ _ fract{~X_1 ./ ~k_1,~X_2 ./ ~k_2}

has the #~{F distribution} with ( ~k_1 , ~k_2 ) degrees of freedom, whose density function is

f( ~y ) _ = _ fract{ rndb{fract{~m,~n}} &Gamma.rndb{fract{~m + ~n,2}} script{rndb{fract{~m,~n}~y},,,{(~m ./ 2) - 1},} , &Gamma.rndb{fract{~m,2}} &Gamma.rndb{fract{~n,2}} script{rndb{ 1 + fract{~m,~n}~y },,,{(~m + ~n) ./ 2},}}

where &Gamma.( &alpha. ) is the gamma function .

We write _ ~Y _ ~ _ F ( ~k_1 , ~k_2 ).

This can be more succinctly written as

f( ~y ) _ = _ fract{ rndb{fract{~m,~n}} script{rndb{fract{~m~y,~n}},,,{(~m ./ 2) - 1},}, &Beta.rndb{fract{~m,2} {,} fract{~n,2}} script{rndb{ 1 + fract{~m~y,~n} },,,{(~m + ~n) ./ 2},}}

where &Beta.( ~a , ~b ) is the beta function

Cumulative Density Function

The cumulative distribution function of the F distribution is

F( ~y ) _ = _ fract{1,{&Beta.(~m/2 , ~n/2)}} int{,0,~y,}fract{(~m ./ ~n)(~m~t ./ ~n)^{(~m ./ 2) - 1},( 1 + (~m~t ./ ~n))^{(~m + ~n) ./ 2}} d~t

Consider the integral on the right-hand side of this equation:

int{,0,~y,}fract{(~m ./ ~n)(~m~t ./ ~n)^{(~m ./ 2) - 1},( 1 + (~m~t ./ ~n))^{(~m + ~n) ./ 2}}d~t _ = _ int{,0,~k,}~u^{~m/2 - 1} ( 1 - ~u )^{~n/2 - 1} d~u

where _ ~k _ = _ ~m~y ./ ( ~m~y + ~n ) . [This is a 'trivial' exercise in change of variable: _ ~u _ = _ ~m~t ./ ( ~m~t + ~n ) . _ If you want to try you'll need a BIG piece of paper. ]

But the right-hand side is just the incomplete beta function , _ &beta. (~k ; ~m/2 , ~n/2), so we can express the F-distribution function in terms of the regularized beta function

F( ~y ) _ = _ I (~k ; ~m/2 , ~n/2) _ = _ fract{{&beta. (~k ; ~m/2 , ~n/2)},{&Beta.(~m/2 , ~n/2)}}

Beta Function

The #~{beta function} of two positive real numbers, ~a and ~b, is defined as

&Beta.( ~a , ~b ) _ = _ int{,0,1,}~u^{~a - 1} ( 1 - ~u )^{~b - 1} d~u

_ _ _ _ _ _ _ _ _ = _ fract{&Gamma.( ~a )&Gamma.( ~b ),&Gamma.( ~a + ~b )}

The #~{incomplete beta function} of ~x

&beta.( ~x ; ~a , ~b ) _ = _ int{,0,~x,}~u^{~a - 1} ( 1 - ~u )^{~b - 1} d~u

The #~{regularized (incomplete) beta function} of ~x

I( ~x ; ~a , ~b ) _ = _ fract{{&beta.( ~x ; ~a , ~b )},{&Beta.( ~a , ~b )}}

[ Warning: Much of the literature refers to the ~{regularized beta function} as the "~{incomplete beta function}". ]

The incomplete beta function can be expressed in terms of a continued fraction

&beta.( ~x ; ~a , ~b ) _ _ _ = _ _ _ ~x^~a ( 1 - ~x )^~b _ # _ rndb{ cfrac{,1,cfrac{1 _ + _ ,~d_1,cfrac{1 _ + _ ,~d_2,cfrac{1 _ + _ ,~d_3, ^#.#._#. }}}}}

where

d_~i _ _ _ = _ _ _ array { fract{ (~a + ~m ) ( ~a + ~b + ~m ) ~x , ( ~a + 2~m ) ( ~a + 2~m + 1 )} {,}, _ ~m = ( ~i - 1 ) ./ 2 {,} , _ ~i odd / _ / fract{ ~n ( ~b - ~n ) ~x , ( ~a + 2~n - 1 ) ( ~a + 2~n )} {,}, _ ~n = ~i ./ 2 {,}, _ ~i even }

Source Numerical Recipes in C chapter 6.2 . Note however that MathymaStats' FDist ( ) function does not use the algorithm in "Numerical Recipes". See instead the notes on Continued Fractions .