Aug 2, 1983 - The commonly used tables of the critical values (or the percentage points) for the Student t, chi-square and. Snedecor F distributions are mostly ...
Statistics & Probability Letters 1 (1983) 223-227 North-Holland
August 1983
An Algorithm to Obtain the Critical Values of the t, X 2 and F Distributions Smiley W. C h e n g a n d J a m e s C. F u Department of Statistics, UniversiO; of Manitoba, Winnipeg, Manitoba, Canada
Received March 1983; revised version received April 1983 Abstract. In this paper a simple and efficient algorithm for obtaining the critical values of t. X2 and F distributions is proposed. They depend only on a direct iterative rational function. The differences between the proposed algorithm and others are discussed.
1. Introduction The commonly used tables of the critical values (or the percentage points) for the Student t, chi-square and Snedecor F distributions are mostly reproduced from two main sources: Fisher and Yates (1938) and Pearson and Hartley (1966). The algorithms employed by Pearson and Hartley (1966) were based on the incomplete beta function or the incomplete gamma function introduced by Karl Pearson (1934) and later extended by Thompson, Pearson, Comrie and Hartley (1941). Due to the advancement of the computer, many algorithms for evaluating the percentage points of various distributions have since been developed. For example, algorithms for the Student t distribution are given by Cooper (1968), Morris (1968), Gentleman and Jenkins (1968), Levine (1969), Hill (1970), Hill and Loughhead (1970), Taylor (1970) and Dudewicz and Dalai (1972), etc. Algorithms for the X 2 distribution have been developed by Hill and Davis (1968), Goldstein (1973), Best and Roberts (1975) and Narula and ki (1977), to name just a few. Aroian (1950), Chen and Makowsky (1976), Morris (1969), and Mardia and Zemroch (1978) have developed algorithms for the Snedecor F distribution. Kennedy and Gentle (1980) give an extensive review of these algorithms. In Sections 2 to 4 we propos e a new algorithm for computing the critical values of the X 2, t and F distribution, respectively. In Section 5 we will discuss the differences between our algorithms and the others. Throughout this paper f , ( x ) denotes the probability density function (p.d.f.) of the random variable X, where ~, is the degree of freedom. For any o~, the critical value ~ associated with c~ is defined by =f~£(x)dx. J~
(1.1)
2. The ehi-square distribution For a chi-square distribution with ~, d.f., the p.d.f, is
L(x)=
1
x¢./2,-,e x/2, x>0.
0167-7152/83/$3.00 © 1983, Elsevier Science Publishers B.V. (North-Holland)
(2.1) 223
Volume 1, Number 5
STATISTICS & PROBABILITY LETTERS
August 1983
The algorithm consists of two cases, d e p e n d i n g on the value of v: (I) W h e n v is even (v = 2k, say) we use the following iterative equation:
~i+,=-2
lna-tn
(2.2)
½~i)' j=0
A possible initial value is ( = - 2 In a, which is the critical value when v = 2. (II) W h e n v is o d d (v = 2k + 1, say) we use the following iterative equation: -2{ln[F(k
~i+1 =
+ ½)] +
ln[2¢~(V"~i)-3+a]-
ln[G(~,)]},
(2.3)
where
G(a)
(.{a){2,
=
( 2 l - - 1) 2k ~ ( 21j - - 1)
,}/2
'
for k > O,
(2.4)
j=l
ar,(y)=-=-f
¢2v -~
e r'/2 d t .
(2.5)
T h e q~(y) can be a p p r o x i m a t e d by the following formula from A b r a m o w i t z a n d Stegun (1964):
• (y) : 1 -~- E b,y' i=o
1
+~,
(2.6)
1
where b o = 1,
b I =0.0498673470,
b4 = 0.0000380036,
Itl
b 2 = 0.0211410061,
b 5 = 0.0000488906,
b 3 = 0.0032776263,
b6 = 0.0000053830,
< 1.5 × 10 - 7 .
A possible initial value is given by the critical value for v = 1, i.e. 2
~:
t-
c//~J,t'+~ t=0
where t=
-21n
[{
½ l+c~+~-
c 0 = 2.515517, d 0 = 1,
I~1
,/m,)
f o r k > 2,
(4.3)
and Tn is a Student's t r a n d o m variable with n d.f., i.e. ½[1-¢
mt tLl ( 2 j ) ! ( l + m t / n ) n + m t j=0 22j(j!) 2
Pr(To > ~ 7 ) =
TM
for n = 2l, (4.4)
1 [cot_,J_~ --IvI V
l/mt - ~Vn-
IL ' j , ( j - - 1 ) , ( l + m t / n ) ~ j=,
22J(2j)!
forn=2l-
1. 225
Volume 1. Number 5
STATISTICS & PROBABILITY LETTERS
August 1983
For n = 1 and n = 2 we have, respectively,
(4.5)
Pr(T. >I ¢mt ) = 1 c o t - ' ~ f m t , fir
and
Pr(T,,
fro-t) = ½ - ½
(4.6)
mt 2+rot
For m = 1. FI. . = T,,2 and for m = 3, we have
B(t)-
-fvvZ'(~n)
3v/3n"/2F(½(n+
Pr(T. > / ¢ ~ ) .
(4.7)
I))
The initial value ~ could be the critical value for m = 1 which is obtained from P r ( T n > / V / r ) = !¢x2, that could be solved by the method in Section 3. (II) When m is even, m = 2k, say, we use the following iterative equation: ~i+' = 71
a(m+--n---2--)m2C(m' n)
[~ki ' + (n + rng;i)("+"-2)/2A(l~i)
rnn
(4.8)
where =
Z
j-1
l=1 k ( n + rn - 2 - - 2/)
t
n
An initial value is the critical value for m = 2, i.e.
n ) / . . ] 2/'- .}. 5. Discussion and comments
Most algorithms for finding the critical values of the X 2 distribution perform very well and are quite accurate. K e n n e d y and Gentle (1980) observed that there were no accurate closed form approximations to the percentage points of Snedecor F distributions. One m a y notice that our algorithm does not involve the approximation of the incomplete beta function or the incomplete g a m m a function. Our proposed algorithm is quite different from other algorithms. It especially differs from the general method given by Hill (1970). F o r instance, in the case of the Student t distribution, the method given by Hill (1970) is based on an infinite series expansion ( K e n n e d y and Gentle (1980, equation 5.57), and on a numerical method to approximate this expansion. On the other hand, our algorithm involves only a finite series of rational functions plus a trigonometric function (equations (3.2) and (3.4)). Hence the critical values can be obtained with a high degree of accuracy as long as the trigonometric function can be c o m p u t e d accurately. Our algorithm for Snedecor F distributions involves a finite series of rational functions and the tail probability of a Student's t distribution (equations (4.2), (4.3) and (4.8)). Therefore, we again expect a high degree of accuracy. The accuracy depends on the convergence criterion, [~,+ L - ~it < e, for specified e. In the statistical tables by Cheng and Fu (1982), the critical values for t, X 2 and F distributions were obtained that were accurate to within 0.0001 using e = 0.0001. The computations were run on an A m d a h l 4 7 0 / V 7 c o m p u t e r at the University of Manitoba. The algorithm performs very well and fast. However, the simplicity of this algorithm is particularly noteworthy. 226
Volume 1, Number 5
STATISTICS & PROBABILITY LETTERS
August 1983
Acknowledgement T h e a u t h o r s w o u l d like to t h a n k t h e N a t u r a l S c i e n c e s a n d E n g i n e e r i n g R e s e a r c h C o u n c i l , C a n a d a , for p r o v i d i n g g r a n t s in s u p p o r t o f this r e s e a r c h . T h e a u t h o r s also w i s h to e x p r e s s t h e i r g r a t i t u d e to t h e e d i t o r a n d the r e f e r e e f o r t h e i r v a l u a b l e c o m m e n t s a n d s u g g e s t i o n s .
References Abramowitz, M. and I.A. Stegun (1964), Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables (National Bureau of Standards). Aroian. L.A. (1950), On the levels of significance of the incomplete beta function and F-distributions, Biometrika 37, 219-223. Best, D.J. and D.E. Roberts (1975), Algorithm AS 91: The percentage points of the X2 distribution, Appl. Stat. 24, 385-388. ('hen, H.J. and A.B. Makowsky (1976), On Approximations to the F-Distribution and its Inverse, Technical Report No. 76-3, Memphis State University, Memphis, TN. Cheng, S.W. and J.C. Fu (1982). Statistical Table for Classroom and Exam Room, University of Manitoba, Winnipeg, Manitoba. Cooper, B.E. (1968), Algorithm AS 3: The integral of Student's t-distribution, Appl. Stat. 17, 189-190. Dudewicz, E.J. and S.R. Dalai (1972), On approximations to the t-distribution, Journal of Quality Technology 4, 196-198. Fisher, R.A. and F. Yates (1983). Statistical Tables for Biological, Agricultural and Medical Research (Hafner Publishing Co., Inc., New York). Gentleman, W.M. and M.A. Jenkins (1968), An approximation for Student's t-distribution, Biometrika 55, 571-572. Goldstein, R.B. (1973), Algorithm 451 : Chi-square quantiles, C A C M 16, 483-485. Hill, G.W. (1970), Algorithm 396: Student's t-quantiles, C A C M 13, 619-620.
Hill, G.W. and A.W. Davis (1968), Generalized asymptotic expansions of Cornish-Fisher Type, A M S 39, 1264 1273. Hill, G.W. and M. Loughhead (1970), Remarks on Algorithm 321: t-test probabilities, Algorithm 344: Student's t-distribution, C A C M 13, 124. Kennedy, W.J. Jr. and J.E. Gentle (1980). Statistical Computing (Dekker, New York). Levine, D.A. (1969), Algorithms 344: Student's t-distribution, C A C M 12, 37 38. Mardia, K.V. and P.J. Zemroch (1978), Tables of the F- and Related Distributions with Algorithms (Academic Press, London, New York, San Francisco). Morris, J. (1968), Algorithm 321: t-test probabilities, C A C M 11, 115-116. Morris, J. (1969), Algorithm 346: F-test probabilities, CA C M 12, 184-185. Narula, S.C. and F.S. Li (1977), Approximations to the chisquare distribution, J S C S 5, 267 277. Pearson, K. (1934), The Tables of Incomplete Beta-Function (Biometrika, London). Pearson, E.S. and H.O. Hartley (1966), Biometrika Tables for Statisticians (Biometrika Trust, Cambridge University Press). Thompson, C.M., E.S. Pearson, L.J. Comrie and H.O. Hartley (1941), Tables of percentage points of the incomplete betafunction, Biometrika 32, 168-181. Taylor, G.A.R. (1970), Algorithm AS 27: The integral of Student's t-distribution, Appl. Stat. 19, 113 114.
227