A Note on Probabilities in the F-Distribution
Vector 10:4, page 124
Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 124
A recent tutorial paper by Alan Mayer in Vector on the use of APL in analysis-of-variance calculations contained a request for methods of calculating probabilities in an F-distribution which were simpler and more satisfying than the one given there. The present note gives an algorithm in J which uses the integral adverb I introduced by Kenneth Iverson in his recent monograph Calculus such that the expression f I x gives the area under the graph corresponding to the verb f from 0 to each item in the list x.
The problem is to evaluate the integral
where \(m\) and \(n\) are, respectively, the degrees of freedom for the numerator and denominator mean squares, and \(F\) is the ratio of the corresponding mean squares. In the following list the verb G is the Gamma function, B the Beta function, Fmn and Fmnx the components of the density function the first of which depends only on the degrees of freedom, and F the probability density function:
G=. !@<:
B=. (G@[ * G@]) % G@+
Fmn=. (([^-:@[) * (]^-:@])) % (-:@[) B (-:@])
Fmnx=. (] ^ <:@-:@{.@[) * ({:@[ +{.@[ *]) ^ (-@-:@(+/@[))
F=. ({.@[ Fmn {:@[) * Fmnx
For example, for 5 and 15 degrees of freedom the 10%, 5%, 2.5% and 1% points for the F-distribution are 2.27, 2.90, 3.58 and 4.56, respectively, and the expression
has the value
The adverb I is defined by the following sequence of verbs (and one conjunction) which is equivalent to approximating the function by four groups of a polynomial of order ten:
W=. +:(#.|.@])"0 1|:@(0:,%.@(^/~@i)%>:@i=. i.@>:@+:)
ew=. +/@(-@(<:@(#@])*i.@[)|."0 1]{.~>:@([*<:@(#@])))
EW=. ([ ew W@]) f.
ai=. '+/@(x.&space * x.&[ * y.@(x.&grid))"0' : 2
grid=. space *i.@#@[
space=. ] % <:@#@[
I=. (4 EW 5) ai
The interested reader is referred to Iverson’s monograph for details.
Keith Smillie
Department of Computing Science
University of Alberta
Edmonton, Alberta T6G 2H1
References¶
Iverson, K. E., 1993. Calculus. Iverson Software Inc., Toronto.
Mayer, A., 1993, Step by step analysis of variance Vector, Vol.10 No.1, pp. 27 - 33.
Standard Mathematical Tables. Nineteenth Edition, 1971. The Chemical Rubber Company, Cleveland, Ohio.