970 Part B

AN ALGORITHM FOR THE
APPROXIMATE NUll DISTRIBUTION
OF HOTEllING'S GENERALIZED To 2
by
Ronald W. Helms
and
Elizabeth Delong
Department of Biostatistics
University of North Carolina
Chapel Hill, NC
27514
Institute of Statistics Mimeo Series No.
July, 1975
970
Keywords:
2
To' Trace Criterion, Multivariate Analysis
LANGUAGE
ANSI Fortran
Summary
An algorithm is presented for computing an approximation
to the cumulative distribution function of Hotelling's
generalized
T~
statistic.
2
DESCRIPTION AND PURPOSE
Hotelling's Generalized ToZ statistic is defined as
where Hand E are independent p x p matrices;
H _ W (nl'
p
~
,
E - Wp (nz,
~
, 0), and is positive definite;
and where W
(n,~,~)
p
~),
and is positive semidefinite;
denotes the Wishart distribution for p x p matrices,
--
with n degrees of freedom, covariance parameter matrix
parameter matrix
~,
and noncentrality
The purpose of the algorithm is to compute an approximation
to the cumulative distribution function of the oenvral distribution (i.e.,
t::. = 0 of T2 .
_
o·
#w
COF
= Pr
[T~ ~ TIt::.
= 0].
(1)
The central distribution is also called the "nu ll" distribution, in part
because
~
is "nu ll" and in part because this distribution is usually the
relevant one under the "nu ll hypothesis" of certain multivariate tests.
3
METHOD
This algorithm evaluates the cumulative distribution fuction of the
distribution of Hotelling's T~ for certain special cases; for combinations
of the parameters which do not satisfy the special cases the algorthim
evaluates the cdf of a distribution which approximates the T~ distribution.
The following notation will be helpful; let
where Hand E are as described above and
is the number of non-zero eigenvalues of HE-I.
leads to difficulties which can be bypassed:
The case s
= nl
< P
the distribution of u{s) can
be derived from the distribution of u{p) [p < nl] by mapping
Thus only the case nl
~
P need be considered.
handles this mapping in the case nl < p.
The algorithm automatically
4
Special cases.
The algorithm produces exact results (to the accuracy
of the incomplete beta function algorithm) in the following special cases.
2
In the case p
= 1 the To is proportional to an F-statistic:
2
To In 1
tV
F (n1' n2),
hence,
2
2
fu)'
[T 0 I (n 2 + To)] tV Be ta (.!!o1'
2 2
and the algorithm evaluates:
where
w = T/(T+n 2 )
= U/(U+l)
In his original paper Hotelling (1951) derived the exact distribution
of T2 for the special case p = 2:
o
_f_[(_n_
l +_n_
2-_1_)1_2_]_ ( 1 -
2 < T] = I (n -l,n )+lTI.
Pr[T 0
w 1
2
f( n /2) f(n /2)
l
2
( n -1)/2
2
W)
1+w
I 2 (nl-_~ ,"2+ 1 )
w
2
2
where
w = T 1(2n 2+T )
= U/(U+2).
This result is used by the algorithm when p=2.
It is interesting that
. Johnson and Kotz (1972, page 199, equation (41)) give an incorrect version of
thi s result.
5
Note that because of the mapping (2) one of these special cases
will be invoked if
nl = 1 or nl = 2 and n < p. Rao(1965, Section
l
8b(xii» treats the special case nl = separately and shows that the
cdf of the To2 distribution is equivalent to the incomplete beta function,
but because of the mapping (2) no special coding is needed for this case.
Moment-Based Approximations.
Pillai and Young(1971) developed
the technique of approximating the density of U(p) by a density similar
to the density of a central F distribution.
The approximation is based
upon finding the parameters of the F-type distribution which make the
first three moments of the distribution of U(p) equal to the first three
moments of the F-type distribution.
The first three central moments of
the central distribution of U(p) are given by Pillai(1960), Pillai and
Samson(1959), and again in Pillai and Young(1971) as:
~l
= P (2m
~2
= [p (2m + p + 1) (2m + 2n + p + 1) (2n + p)]/ [4n 2 (n - 1) (2n + l)J
~3
= p (2m + n + p + 1) (2m + p + 1) (2m + 2n + p + 1) (n + p) (2n +p)
+ p + 1) / (2n)
2n 3 (n - 1) (n - 2) (n +1) (2n + 1)
where
m = (nl - P - 1) / 2
n
= (n2
- P - 1) / 2.
The F-type density function
a l
f( x; a" b K) = xa/{S (+1
a , b-a-1) K + (l+x/K)b}
has the following first three central moments
o<
x
<
00
6
~Fl
= K (a+l) / (b-a-2)
~F2 = [K 2 (a+l) (b-l)] / [ {b-a-2)2 (b-a-3)]
~F3 = [2 K3 (a+l) (b-l) (a+b)] / (b-a-2)3 (b-a-3) {b-a-4}].
This F-type distribution is identical to the standard central F distribution
with
k1 and k2 degrees of freedom if one imposes the restriction
and uses the relations
However, without the restriction on K the F-type distribution has three
parameters: a,b, and K.
Setting the first three moments of the distribution of U{p) and
the F-type distribution equal and solving for a,b, and Kyields
7
a
=
3
2
2
2
2
(2UIU2 + 3UIU3 - 6uluz - UZU3) / (UZU3 + 4UIU2 - UIU3)
2
2
b = [(a+l) (a+3) - UI / U2] / [ (a+l) - UI / Uz]
K = UI (b-a-2) / (a+l)
Note that in Pillai and Young (1971) there is a typographical error in
the expression for a; the last minus (-) sign in the expression above is
erroneously given as a plus (+) sign in that paper.
The first three moments of these distributions do not exist for
all possible values of the parameters.
The following is a summary of
necessary and sufficient conditions for the existence of the indicated
moments:
Distribution
U(p)
Moment
Conditi on for existence
F-Type
Moment
Condition for existence
Ul
n2 > p+l
UFl
b-a > 2
U2
n2 > p+3
UF2
b-a > 3
U3
n2 > p+5
UF3
b-a > 4
In each of these cases it is assumed the mapping (2) has been performed if
n1 < p and the statements and expressions apply to the transformed parameters.
8
If the combination of parameters is such that one of the third-order moments
(~3
or
~F3)
does not exist, one can obtain a two-moment approximation by
equating the first two moments of the two distributions.
The following
expressions for a, b, and K will generate a two-moment approximation:
K
=p
a
=
b
=[
[~2
~l
~l - p) +
2
~l ( ~l + P)]/(P~2)
2
( ~l + p) + ~1~2 + 2p~2]/(P~2)
Similarly, a one-moment approximation is generated by the following expressions:
K= p
a = p (2 m+ p + 1) /2 - 1
b = p(2 m+ 2 n + p + 1) /2 + 1.
Operational procedure.
The algorithm first checks the input
parameter values to determine whether they have proper values (e.g.,
T ~ 0, etc.).
The algorithm then checks for the special case nl < p;
if so, the mapping (2) is performed. The upper limit, T, is converted
to a U(p):
cases p
=
evaluated.
U = T/n .
2
1 or p = 2.
The algorithm next checks for one of the special
If a special case applies, the exact cdf is
If neither of the special cases apply, the algorithm computes
m and n (defined above) and determines whether the third moments of both
distributions exist.
approximation is used.
If both third moments exist the
three-moment
Otherwise a two-moment approximation is attempted.
If one of the second-order moments does not exist, a one-moment approximation
9
is attempted.
If one of the first-order moments does not exist the
algorithm sets the failure indicator (IFAULT) and returns control to the
calling program.
If the three-, two-, or one-moment approximation is
used, the algorithm uses the incomplete beta function subprogram to
evaluate:
CDF
=
I (a+l, b-a-l)
w
- Pre T~ < T
TI
where
w = T/(T+Kn 2 )
and where
=
U/(U + K)
a, b, and K are evaluated from the expressions of the
highest-moment approximation applicable.
10
STRUCTURE
SUBROUTINE HOTELL (T, Nl, N2, IP, CDF, IFAULT, IAPRX)
Formal Parameters:
~ Pr[T~ ~
T
Real
input:
The algorithm computes CDF
Nl
Integer
input:
Number of degrees of freedom of}the distribution of ~ in T~ =n2Tr(~ ~- )
N2
Integer
input:
Number of degrees of freedom of the distribution of E.
IP
Integer
input:
The matrices Hand E are IP x IP; IP
corresponds to the -parameter p in the
discussion.
CDF
Real
output:
CDF
I FAULT
Integer
output:
Failure indicator.
IAPRX
Integer
output:
Indicates the type of approximation used.
~
T]
Pr[T20<- T].
IAPRX=-3 :
Exact computation for
T=O
IAPRX=-2:
Exact computation for
special case p=2
IAPRX=-l:
Exact computation for
special case p=l
IAPRX=O:
Algorithm failure;
approximation technique
not applicable
IAPRX=l:
One-moment approximation used
IAPRX=2:
Two-moment approxmiation used
IAPRX=3:
Three-moment approximation used
11
Failure Indicators:
IFAULT
=
0
IFAULT
= -1
indicates one of the input parameters has an
improper value [i.e., T<O, N1 < 1, N2 < 1,
IP < 1J. CDF is returned with a value of -lE75.
IFAULT
=
indicates the combination of parameters T,
N1, N2, and IP is such that the first moment
of the approximating distribution is not finite,
i.e., the technique is not applicable. CDF is
returned with a value of -lE75 and IAPRX = O.
IFAULT
=2
indicates W!O or W~ 1 where W= T/(T + K * N2),
which should never happen, i.e., IFAULT = 2
indicates a programming error. CDF is returned
with a value of -lE75.
indicates no errors were detected.
12
RESTRICTIONS
The parameters
n , n2 , and p must satisfy the restrictions
1
given above for the existence of moments for a particular approximation
to apply; i.e., the minimal restriction is
n > p+1, which applies
2
to both the original parameters and the transformed parameters if the
mapping (2) is invoked.
The restrictions shown for a and b must
also be satisfied, but there is no simple statement of these restrictions
in terms of n1 , n2, and p.
These restrictions guarantee that the
algorithm will operate as described but do not guarantee that the
approximation used will be accurate.
Additional restrictions are
described in the section discussing accuracy.
13
AUXILLARY ALGORITHMS
The present version of HOTELL uses BETAIN, Algorithm AS 63,
"The Incomplete Beta Integral," by Majumder and Bhattacharjee
(1973).
BETAIN requires the prior computation of the complete beta function,
B(p,q)
=
r(p)r(q)jr(p+q).
HOTELL assumes the availability of a single
precision function subprogram, ALGAMA (X), which evaluates loge r(x).
Virtually all computer manufacturers provide an efficient, accurate
subprogram for log r(x) and such a routine may be easily substituted
for ALGAMA in HOTELL.
If such a routine is not available the algorithm
of Pike and Hill (1960) may be implemented in Fortran under the name
ALGAMA.
14
ACCURACY
Errors in this approximation have three components:
(a)
differences
between the cdf's of the F-type distribution and the distribution of u(p),
(b)
errors in approximating the incomplete beta function, and (c) calculations
performed in the routine.
Pillai and Young (1971) included a comparison of the approximations to
the exact distribution for n
= (n 2-p-l)/2 = 5, 10, 15, 20, 30, 40, 50,60,
(p,m) = (p, (n l -p-l)/2 ) = (3,0), (3,3), (4,0), and (4,2).
They concluded that this approximation "... provides about three significant
80, and 100, and for
digits accuracy in the percentage points for n ~ 10.
In some cases
n
>
5
is sufficient for this accuracy" and that "... the distribution function for
[this approximation] provides a good approximation [about three decimal places]
to the exact distribution of U(p) for n ~ 10 and for the whole range of U(P)."
4It
Note that the first quote refers to the percentage points, i.e., the inverse
of the cdf, and the second quote refers to the cdf itself.
(Emphasis added.)
In our tests of this routine we reproduced the relevant results of
Table II in Pillai and Young (1971) to the number of digits given there.
Errors of types (b) and (c) above are more within the control of the
user of the algorithm.
computer with a short
If HOTELL is implemented on an IBM 360, 370, or other
(~
24 bits) single precision floating point mantissa,
double precision is absolutely essential for accurate computation, especially
for the special case
p
= 2. A double precision version is easily produced; one
need change only the initial declarations, including the declaration of the
arithmetic statement function CBF (complete beta function), the names of the
functions EXP, ALGAMA, and ALOG in statement 9,
and function BETAIN.
In a
double precision version of HOTELL (and BETAIN), or a single precision version
on machines with long floating point mantissas, the computational errors in
15
BETAIN and HOTELL will typically be negligible compared to the error of the
approximating technique (type (a), above).
16
REFERENCES
Hotelling, H. (1951)
A Generalized T-test and Measure of Multivariate
Dispersion, Proceedings of the 2nd Berkeley Symposium on Mathematical
Statistics and Probability, 23-41.
Johnson, N. L. and S. Kotz (1972).
Distributions in Statistics:
John Wiley & Sons, Inc.,
Continuous Multivariate Distributions.
New York, 1972.
Majumder, K. L. and G. P. Bhattacharjee (1973).
Incomplete Beta Integral.
Pike, M.C. and I. D. Hill (1966).
Function.
Hypotheses.
The
Applied Statistics, 22, 409-411.
Algorithm 291.
Commun. Ass. Comput.Mach.,
Pillai, K.C.S. (1960).
Algorithm AS63.
~,
Logarithm of the Gamma
684.
Statistical Tables for Tests of Multivariate
The Statistical Center, University of the Philippines,
Manila.
Pillai, K.C.S. and P. Samson, Jr. (1959).
of T2 •
On Hotelling's Generalization
Biometrika, 46, 160-165.
Pillai, K.C.S. and D. L. Young (1971).
Hotelling's Generalized
T~.
On the Exact Distribution of
Journal of Multivariate Analysis,
1, 90-107.
Rao, C. R. (1965).
Linear Statistical Inference and Its Applications.
John Wiley & Sons, Inc., New York, 1965.
1 8
SUB ROUT I NE HOT ELL LIS TIN G
C. **
:::
C
SOBFOUTINf
c::
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
c::
C
C
C
:;
C
C
C
:::
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
r
HOTL
HO'l'L
HOTELL(T,~1,N2,IP,CDF,IFAULT,IAPRXI
HOTL
HO'l'L
HOTL
DESCRIPTION AND PURPOSE
HO';'L
HOTL
H0~ELLING'S GENERALIZFD T(0).*2 STATISTIC !S DEFINFD AS
HOTL
HOTL
T(0)**2 = N2*TRACE(H*F**-1)
IIOTL
flOTL
WHE~F HAND E ARE INDEPENDENT P X P MATRICES;
HOTL
HOTL
H flAS A w(P;N1,S,D) DISTRIBUnCN A~D IS POSITIVE SEMIDEfINITE; HOTL
Hon
F HAS A W(P;N2,s,0) DISTRIBUTION AND IS POSITIVZ DEFINITE;
HOTL
HOTL
AND WHE!'! io! (P;N,S,DI D~N()TES THE WISHART DISTRIBUTION FOP P X l'
HOTL
MATRICES, WITH N DEGREES OF FREEDO~, COVARIANCF PARAMETER MATRIX !lOTL
S, AND NONCENTRALI'l'Y PARAME':'ER MATRIX D.
THIS ALGORITHIII COMPUTES HOTL
AN APPROXIMATION OF THE CUMULATIVE DISTRIBijTION FUNCTION 0F THE
HOTL
CEN,RAL DISTRIBUTION (I.E., D=OI OF T(01"2; THAT IS, THIS
HOTL
ALGORITHM COMPUTES AN APPROXIMATION TO
HOTL
1I0TL
cnF = PR (T (01 **2 < T I D=O)
Hon
HOTL
TH~ CENTRAL DISTRIBUTION IS ALSO CALLED THE "~ULL" DISTRIBUTION,
HOTL
IN PAPT BFCAUSE D IS "NULL" AND IN PART BECAUSE THIS DISTRIBUTION HOTL
IS USUALLY THE REL~VANT ON! UNDER THE "NULL HYPOTHPSIS" OF CERTAINHOTL
MULTIVARIATE T1>S1'S.
HOTL
Hon
HOTL
METHOD
HOTL
HOTL
THE ALGOFI~!IM PFODUCPS EXA::T RESUL'IS (TO THE ACCUf<ACY OF THE
HOTL
I~COMPLETE BETA FUNCTION ALGORITHMI
IN TilE SPECIAL CASES IP=1,
HorL
IP=2, ./tND T=O.
flOTL
HOTL
IF N)N~ OF ~HE SPECIAL CASES APPLY, THEN THE ALGOPITHM
HOTL
IS AN I~PLEMENTATION OF AN APP~OXIMATION DEVELOPED BY PILIAI
HOTL
AND YOUNG (19711.
THE APPROXIMATION IS BASED UPON SELECTING AN
HOTL
f-TYPE DISTRIBUTION WHICH HAS THE SAME PIRST THREE MOMENTS AS
HOTL
THF DISTRIBUTION OF
H01'L
HOTL
U = (T (0) **2) IN2
HOTL
HOTL
THEN
PH (T (01 **2 < T)
IS APPROXIMATED BY
PR(F < T/N2).
AFTERHOTL
A TFANSFORMATION,
PR(F < T/N21
IS EVALUATED AS
HOTL
PF (BETA < W = T/(TtK*N'2) I = I"iCOMPLETE BFTA. fUNCTION EVALUATED AT HOTL
~, WIIERE
BETA
HAS THE APPROPRIATE BETA DISTRIBUTION.
HOTL
HOTL
IF THE THIRD MOMENT OF THE F-TYPE DISTRIBUTION DOl'S NOT EXIsT,
HOTL
BUT THE SECOND MOMENT DOES EXIST, THE ~PPROXI~ATICN IS BASFD ON
HOTL
THE FIRST TWO MOME'lTS.
LIKEWISE, IF BOTH THE THIRD AND SECOND
HOTL
MOMl'lTS DO NOT EXIST, ~nT THE FIRST MOMENT DOES EXIST, THl
HOTL
APPROXIMATION IS BASED ON THE PIPST MOM~NT. IF NONE OF THE
HOTL
THREE MOMENTS EXISTS, THE APPROXIMATION IS NOT APPLICABLE AND
HOTL
THE ALGORITHM DOES NOI ATTEMPT AN APPROXIMATION.
HOTL
HOTL
HOTL
USAGE
HOTL
0
10
20
400
410
420
430
440
450
460
470
480
490
500
510
520
530
540
550
560
570
58C
590
600
HnT~
~1n
10
40
50
60
70
80
9G
100
110
120
no
140
150
160
170
180
190
200
210
220
230
240
250
260
270
2AO
290
ClOO
310
320
-no
340
350
360
370
380
39~
19
SUB R0 UTI NE HOT ELL LIS TIN G
c
C'
C
C
C
C
C
C
C
C
...,..
C
C
C
c
c
C
c
C
C
C
C
HOT L
HOTL
HOTL
HOTL
D~SCPIPTION Of PARAMETERS
HOTL
HOTL
HOTL
T
-HEAL INPUT: THE ALGORITHM CO~PUTES
HOTL
ern' = ?R (T (01 **2 < T) APPRiJXnlATELY
HOTL
HOTL
OF FREEDOM OF THE
NU!'IB~R OF D",GREES
-INTEr-Ell INPUT:
N1
DISTRIBUTION OF H IN T (0) **2=TR (H*E**-1) HOTL
HOTL
HOTL
NUMBE;P OF DEGREES OF FREEDO/'l OF THE
-INTEI;FP T'IPU:':
N2
HOTL
DISTRIBUTION OF E
HOT L
HOTL
THP MATRICES H AND E AHE IP X IP; IP
-IN1'EGF!l INPUT:
If'
HOTL
COFF. ES PON OS TO THE PARAMETER P IN THE
HOTL
DISCUSSION
HOTL
HOT1
C1F
-PEAL OUTPUT:
COP = PR(T(0)**2 < T)
APPFOX!MATELY
CALL I10TELL (T."I1.N2.IP.CDl",IFAULT.IAPRXI
IFAULT
-INTEGER fAILURE;
INDICA~OR:
C
C
C
I FA UL 1'=0
INDICATES NO
C
lFAULT=-1
C
C
C
C
C
INDICATES ONE OF THF INPUT PARA~ETFRS
HAS A.N IMPROPER VALU~. (I.E. T<O. N1<1.
N2<1. 1P<1). CDE IS RETURNED WITH A
VAW'? OF -1"'':75.
I FA ULT=1
~RROPS
WERE DETECTED
INDICATES ~HE COMRINATION OF PARAMETERS
N1. N2. AND IP IS SUCH THAT THE
FIFsr MOMENT OF THl:' APPROXIMATING
DIsrPIBUTION IS Nl~ FINITE. I.E •• THE
TECHNIQUE IS NOT APPLICA9LE. CDF IS
PETURNFC WITH A VALUE OF -1~75 AND
IAPRX=').
T,
C
C
C
C
C
c
c
I FA UL 1'=2
C
C
C
c
c
c
C
TAPRX
-IN~EGER
BDICATES W .LE. C OF W .:;P. 1 WHERE
W=T/ ('I'tK*N2). ~/lIIC Ii SHOULD NEVER
HAPPEN. I.E •• IFAULT=2 INDICATES A
PROGRAMMING ERROF.
COP IS RETURNFD
WI'T'H A VA UP' OF -1 E75.
INDICA TOP OF TYPE OF APPROXIMATION USED
C
C
IAPRX=-3
EXA:T COMPUTATION FOP T=0
IAPRX=-2
EXACT COMPUTATION FOR SPECIAL CASE P=2
!APRX=-1
EXACT COMPUTATION FOR SPECIAL CASE P=1
IAPPX=O
ALGORITHM FAILUFE; APPROXIMATION
T!CHNIQUE NOT APPLICABLE
IAPRX=1
ONE-MOMENT APPROXIMATION USED
IAPRX=2
TWO-MOMENT APPROXIMATION USED
IAPRX= 3
THREE-~Of'lENT
C
C
C
c
C
C
C
C
C
C
C
C
C
C
C
("
SUBFOUTINES RFQUIPED
APPROXIMATION USED
620
630
64('
650
660
670
680
691'
700
710
720
730
740
750
760
770
780
790
800
810
HorL 820
HOTL 830
HOTL 840
HOTL 850
HOTL 860
HOTL 870
HOTL 880
HOTL 890
HOTL 900
HOTL 910
HOTL 920
HOTL 930
HOTL 940
HOTL 950
HOTL 960
HOTL 970
HOTL 980
HOTL 990
HOTL1000
HOTL1010
HOTL1020
HOTL1030
HOTL1040
HOTL1050
HOTL1060
HOTL1070
HOTL1080
HOTL1090
HOTL 1100
HOTL111(1
HOTL1120
HOTL1130
HOTL1140
HOTL1150
HOTL1160
HOTL1170
HOTL1180
HOTL1190
HOTL1200
HOTL1210
HOTL1220
HOTL1230
HOTL1240
HOTL1250
HOTL1260
Hn'1'T.1 ?70
2a
SUB ROUT I NE HOT ELL LIS TIN G
C
C
C
C
C
C
c
c
c
C
C
C
C
C
::
C
C
C
C
C
C
C
C
C
C
C
C
C
c
C
c
C
C
c
C
C
(~PPLIED
IIOTL1280
1I0TL1290
HOTL 1300
HOTL1310
HOTL1]20
HOTL13]0
HOTL1340
"IA,JlJ"D~!l. K. L. AND G.P.
3HATTACHARJFE (1973).
ALGORITHM AS63.
HOTL 1350
THE INCO"lPLETE BETA INrEGRAL.
APPLI~D 5TArIsTIcs, 22,
HOTL1360
1.109-411.
HOTL1370
HOTL1380
PILLAI, K.C.5. AND D.L. YOUNG (1971).
ON THE EXACT DISTRIBUTION
HOTL1]90
OF HOTO:LLIW;'S GENERA.LIZED '1'(0)**2.
JOURNAL OF
1I0TL1400
MULTIVAFIAT" ANALYSIS, 1, 90-107.
1I0TL1410
1I0TL1420
HOTL 1430
HOTL1440
HOT L 1450
SIPFU[JTI'<E HO':'ELL (T,N1,N2, IP,CDF, IFAULT,IAPRX)
1I0TL1460
HOTL1470
"Ill::' AL::;ORITH"I CO,"PUTE5 AN /,\PPRI)XIMATION TO TH": CUf'lULATIVE
IIOTL1480
DISTRIBUTION FUNCTION OF THE CENTRAL DISTRIBUTION OF HOTELLING-S
1I0TL1490
GENERALIZED
'1'(0)**2
STATI5~IC, I.E.,
IIOTL1500
HOTL1510
C')F
PR ('1'(0) **2 .LT. '1'), 7\PPROXIMATELY.
HOTL1520
IIOTL15]0
HOTL1540
VERSION DATE
14 JULY 1975
HOTL1550
HOTL 1 560
SfJPlif)UTTNf. HOTELL ('1', N1, N2 ,IP,CDP ,IFAULT, IAPFX)
IIOTL1570
IIOTL1580
DECLA RATIONS
IIOTL1590
ARGUMENTS
HOTLHOO
HOTL1610
PEn
CDF,T
IIOTL1620
INTEGER N1,N2,IP,IFAULT,IAPFX
HOTL1630
HOTL1640
FUNCTION SUBPRCGFAMS
HOTL1650
HOTL1660
R~AL
BETAIN,CBF
IIOTL1670
CBF(A,B)= EXP(ALGAMA(A)tI\LGAMA(B)-!lLGAf'lA(AtB))
HOTL1680
HOTL1690
INTERNAL VARIABLES
HOTL1700
£I0TL 17 10
R~AL
A,A1,A2,B,B,,8ETA,TADD,rEMP1,TERM1,TER~2,TK,TM,TMU1,Tf'lU2 HOTL1720
REAL
TMU3,TMU1SQ,TMU2SQ,TN,TN1,TN2,TP,~WOTN,U,W
HOTL1730
1I0TL1740
INTERNAL CONSTANTS
1I0TL1750
1I0TL1760
FEAL
ZERO/OEO/,ONE/1EO/,TwJ/2EO/,THPEE/3EO/,FOUR/4EO/,SIX/6 EO/
HOTL1770
RFAL SQRTPI/1.7724539/
HOTL1780
HOTL1790
BEGIN EXECUTION
IIOTL1800
HOTL1810
IAPFX
IIOTL1820
IFAULT = -1
HOTL 18]0
CDF
-1£75
HOTL1840
1I0TL1850
CHECK fOR T .11". ZEPa
OF INVALID VALUES OF N 1, N2, AND IP
1I0TL 1860
1l0TL1870
!FeN1 .LT. 1
.OI<.
N2 .LT. 1
.OF.
IP .LT. 1) GO TO 20
HOTL1SQ0
H(T)20, 7, 3
HOTL1890
2 CT)P=ZERO
1I0TL1900
lAPRX
1I0TL1910
IfAULT
0
HOTL1920
SF-TAIN
STATISTICS ALGORITHM A56].
BELOW)
SEE FIRST
P~FEF":NC~
=
= (\
=
C
C
C
= -]
=
r.O 'T'O
)()
HO'T'T.1 (llO
21
SUB R0 UTI NE HOT ELL LIS TIN G
c
c
I? N1
c
.LT.
IP,
(N1,N2,IP)
>4APS'1'O
(IP,N1+'12-P,N1)
c
:3 IF
(N1 • GE. H)
TI.1
11:1
TN2 = '11+N2-TP
TP
N1
GO TO 'i
U 'T'N1 = N1
TN2 = "I?
TI'
IP
G0 TO
=
U
=
=
5
C
C
U
=
TlN2
CHECK FOR
SPECT~L
CASE P
C
IF ('1'P. GT.
IAPPX = -1
A1=TN1/TWO
B1=TN2/TII0
W=U/ pItON")
GO :'0 15
GfJ TO 6
ONE)
c
CHECK
C
FOR
SPECIAL OSE P=2
C
6
IF (TP • GT.
IAPFX=-2
TWO)
(;0 TO 10
c
NOTE THAT TN1
C
C
• GT.
BFCAUS E 2
TP
.L~".
TN1
A'=TN1-0NE
II=U/ (UtTWO)
BFTA=CI:lF(A1,TN2)
'T'F~~1=BETAIN(W,A1,TN2,B~TA,~FAULT)
IF(I?AULT .NE.
0)
GO TO
20
A1=~.1/TWO
A2=(TN?t O NF)/TWO
TFMP1=W*W
DFTA=CBF (1\~ ,A2)
TFRM2=BFTAI~(~EMP1,A1,A2,BETA,IFAULT)
IF (HAnLT
~
C
C
• NE.
0)
GO TO 20
EXP( ALGAMA (FN1tTN2-0NEI/TWO)
1
-UGH'A (TN1/TIIO) -AI.GAMA (TN2/TWO)
2 t «TN2-0NF) /'1'110) *nOG ( (ON~-wl/ (ONFtW) ))
CDF=TFRM 1-TFRM2
GO 'T'O 20
TFPM2=~ERM2*SQFTPI*
COMPUTE
'1
(IN '1''''1)
AND N (IN TN)
C
10
TM =
TN =
(TN1-TP-nNE) /TWO
(TN2-TP-ONE)/TWO
C
C
C
IF TN .LE. 0 THE FIRST MO"lENT ('1'I1U1) OF THE DISfFIBUrrON OF T (0)
DOES NOT EXIST AND THE APPROXI"IATION TECHNIQUE IS INVALID.
**2
C
IF(TN .LF. ZERO) GO TO 13
TWOT N = 'l'WO *TN
TADD = TWO*TM~TPtONE
TMU1 = ~P*TAID/TWOTN
c
C
C
IF ,N • U.
IFITN
1 TIlE SECOND MOMEn
('l'MU'1)
DOES NOT EXIST
.LE. ONE) GO TO 12
= TMU1*(TWOTN+TADDI * (Ti40TN+TP) !(TWOTN* (TN-ONE) * (TIiOTNtoNE) )
"'Mfl1 so= 1'''''1l1*1'''''fl1
T~U2
HOT L 1940
H01'11950
I10TL1960
HOTL1970
IIOTL1980
H01'L1990
[!On2000
HOT L201"
HOTL2020
HOTL2030
HOTL20UO
HOTL2050
HOTL2060
1l0'T'L2070
HOTL2080
HOTL2090
HOTL2100
f10TL2110
f10TL2120
HOTL2 1 30
H01'L21UO
HOTL2150
HOTL2160
HOTL2170
HOTL21fl0
HOTL2190
HOTL220n
HOTL2210
HOTL2220
HOT1223C
HOTL2240
HOTL2250
HOTL2260
HOTL2270
HOTL 2 280
HOTL2290
HOTL230('
HOTL2310
HOTL2320
HOTL2330
HOTL2340
HOTL2350
HOTL2360
HOTL'1.37C
HOTL2380
HOTL2390
HOTL2400
HOTL2410
HOTL2 U20
HOTL2430
HOTL21i40
HOTL21i50
HOTL21i60
HOTL2470
HOTL2480
HOTL2490
HOTL2500
HOTL2510
HOTL2520
HOTL2530
HOTL2540
HOTL2550
HOTL2560
HOTL2570
HOTL2580
HO'l'T.?r;qo
22
SUB R0 UTI NE HOT ELL LIS TIN G
C
C
C
IF TN
~
.U.
THE THIRD MOMENT
(TM1l31
DOES NOT EXIST
IF'(TN .LE. TWOlGO "'011
~Mu3 = (TWO*~MU2* (~Nt1'ADDl * (TNtTP) I/{TN* (TN-TWOl * (TNtONF»
T~U2SQ
TMU2*TMU2
=
C
C
C
c
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
HOTL2600
IiOTL2610
HOTL2620
HOTL2630
HOTL264C
HOTL26~O
HOTL2660
COMPUTE A A~D 3 FOR THE THREE-MJMENT APPROXIMATION
HOTL2670
HOTL2680
A = ('1'''lUl* (-Srx*TMU2SQtTMU1 * (THREE*TMU3tTWO*TMU1*TM1l2» -TM1l2*TMU3) HOTL2690
,
I(TMU2*TMU3+FOUR*TMU1*TMU2SQ-TMU1SQ*TMU3)
HOTL2700
B
«AtONE) * (AtTH"EE) -TI'IU1 SQ/TMU21/( (AtONEl-TMU1SQ/TMU 21
HOTL2710
HOTL2720
CHECK FOg (3-A) .LE. 4
HOTL2730
HOTL2740
IF (B-A .LE. FOUl') GO ':'0 11
HOTL2750
IAPPX = 3
HOTL2760
TK = TMU1* (B-A-Twol/(AtONEl
HOTL2770
w=U/(UtTKl
HOTL2780
HOTL2790
W IS TH! UPPER LIMIT FOP USE WITU THE CUMULATIVE DISTRIB~TION
HOTL2800
FllNC'!'ION OF THE
BFTA(A1,B1)
DISTRIBUTION;
HOTL2810
HOTL2A20
P!'(T(OI**2 .LT. Tl = PR(BETA .LT. WI, APPROXIMATELY
HOTL2830
HOTL2840
GO TO 14
HOTL2850
HOTL2860
COM~UTE A AND B FOR THE T~O-MOMENT APPROXIMATION
HOTL2870
HOTL2880
TEMP1 = TP*TMJ2
HOTL2890
11
A
(TMU2*(TMU1-TPltTMU1SQ*(TI'IU1+TP»/TEI'IPl
HOTL290C
8 = (TMnl*(TMU1tTr)**2tTMU1*TI'IU2tTWO*TEI'IP11/TEl'IPl
HOTL2910
HOTL2920
CHECK FOP B-1\ • L E. 3
HOTL2930
HOTL2940
IF (B-A .LE. ~HI:iEEI GO TO 12
HOTL2950
:APFX = ?
HOTL2960
w=U/(Ut"'P)
HOTL2970
GO ~O 14
HOTL29BO
HOTL29':l0
COMPUTE A AND B FOR THE C~E-MOMENT APPROXIMATION
HOTL3000
HOTL3010
12 A
TP*TADD/TWO-0NF.
HOTL3020
3
TP*(TAQD+TWOTNl/TWOtONE
HOTL3030
HOTL3040
CHECK FOR B-A .LE. 2
HOT13050
HOTL] 060
!'" (B-A • LEo TilOl GO TO 13
HOTL3070
IAPPX = 1
HOTL3080
W=U/(Ot~Pl
HOTL3090
GO TO 14
HOTL3100
HOTL3110
iillEN B-A • LE. 2 THE APPROXIMA'l'ION TECHNIQUE IS NOT APPLICABLE.
HOTL3120
HOTL3130
13 IAPFX = 0
HOTL3140
:FAULT = 1
HOTL3150
GO TO 20
HOTL3160
14 A1=A+ONE
HOTL3170
B1=B-A-ONE
HOTL3180
HOTL3190
A CHFCK IS MADE TO INSUPE THAT THE PAliAMETERS
W, 11, 81,
ARE
HOTL3200
WITHIN THE FANGE OF THE INCOMPLETE BETA FUNCTION.
HOTL3210
HOTL3220
15 IF (W .LT. ZERO) GO TO 20
HOTL3230
IF (Al .LE. ZEEO .OR. B1 .LI'. ZERO) GO TO 20
HOTL3240
a~'" ~=c:af
(A 1 - ~1)
HO'l'T.1 :;><;0
23
SUBROUTINE
CDF=BETAIN (W,A1.91. BFTA, IFAULT)
If' (!FAULT .N~. 0) CDP
-1E75
FFTUR>;
=
20
END
HOTELL
LISTING
HOTL3260
HOTL 3 210
HOTL3280
HOTL3290
24
SUB R0 UTI NEB ETA I N LIS TIN G
e
FUNCTI1~
H~TAIN(X.P.Q.GETA.IFAULT)
1~
r.
20
",' fA
clETA
J i~ r.
Lie
dET
C
C
AL;or:rTHM AS
c
c
c
c
e0~?UTES
63
APPL STATIST.
(1973).
VOL.22.
HETA INTEGRAL FO~ ARGUMF~!S
r .~'lD v POSIl'IVE.
FUNCTION IS ASSUMED TO 5i> KN )~~.
INCOMPLETE
(nt1PLETl
'j.':? A
uETlt
J:::T 1\
nETA
leu
DAT~
ACCURACY
AND
INITIAL~S~
/0.1E-7/
= X
BETUN
c
!?ST FOR
ADMISSIBILITY Of
IFAI1LT = 1
IF (P • L E. O. O. 01\. Q. LE • C •
IFlULT = 2
~)
I f (XoLT.O.0.OR.X.GT.1.0)
IFAUL'" = 0
I!' (K.'OU.O.O.OP.X.EQ.1.0)
e
c
CHANGE TAIL
IF
ARGUMENTS
R lOT H. N
RETJRN
RET,JPN
NECFSSA~Y A~D
DETERMINE S
= ::' +
PSQ
Q
cx=1.0-X
IF
*x)
( P • GE • P S Q
GC'T' J
1
110
120
RETA
130
BITr. 11.0
J3I:TA 1 'il~
DE.; 10 :'l
dL! !': 17r
H Ll' A 1!:l (.
iH,"A 19°
ilETA 200
210
dE fA
d:;'" A
bETlt
[JET A
BETA
3£TA
iJE':'A
EETA
31,TA
3£ fA
dETA
310
22C
230
240
25G
260
27')
280
290
30u
?P
Q
unA
32C
2Q
P
JE? 11
DLTA
34.)
=
.TRUE.
pp = P
:'>Q = Q
= • FA LS£.
INDEX
? TERM = 1.0
AI
=
1.0
BETAI~
NS
=
QQ
=
1. 0
+ eX *
USE SOPER-S
PSQ
REDUCTION FORMULAE.
=
4
6ETA
oET _I,
ex
x
GOTO 2
XX
x
C
C
s'~
6G
70
8C
xx
ex
IND:':X
e
~
'Ie
q'l
t3ETA 100
I~DEX
D~F!NE
c
c
c
r.
H;;·
LnGICAL
c
~'J. 3
X HE'TWEEN lEBO AND CNE,
c:
RX
XX/CX
TEMP = QQ - AI
IF (NS.EQ.O) RX = XX
T"Pl = TEFM
;:f:1P
EX I (PP
AI)
BETA IN
EfTAI~ + TER~
TEMP = ABS(TERI'!)
IF' (':'EMi'.LE.ACU.A~JD.TE"lP.LF:.AC[J*BETAIN)GOTO 5
AI = AI
1.0
NS
NS - 1
IF (NS.GE.O) GOTO 3
Tl'MP
f-Slol
PSQ
['so
1.0
GOTO 4
*
=
=
=
=
C
"r:. -~ p,
Si.T
C***
e
e
.r..
r
+
+
CALCULATE RfSULT
*
+
i:s"TA
;Hell
Jr.1A
EFTA
iJETA
HETA
dnA
i.:ErA
dPT .;
lETA
:;:0711
BETA
13,)
'50
36')
37'.~
380
39C
4('1'
41:)
420
430
440
45,)
460
UETA 470
"ITA 4He
GETA 4'lJ
ili':':'A SCC
dE r.1\ 51 C'
HIl'A S20
BfTA 53"
1.JETA 540
Ii I::' A 'i50
JETA 5t>O
SET.I\. 570
::lETA 580
BETA
BI:.1' .1\
;jET A
dP'A
590
600
610
620
25
SUBROUTINE
5
BETAIN
LISTING
TAIN = IJE'!'AIN * EXP(PP*ALOG(XX)tlQQ-1.0)*ALOG(CX)I/(PP*D~TA)
I
(INDEX) RETAIN = 1.0 - BSTAI~
h TURN
"1:.T:\ .,3C
3fT r- b4J
BE':'.~
65J
!':ND
bETA
6f,~
[l
26
THE FOLLOWING RESULTS OBTAINED FROM SUBROUTINE HOTELL AGREE WITH THOSE
OF TABLE II IN PILLAI AND YOUNG (1971)
N1
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
5
5
5
5
5
5
5
5
5
5
N2
14
14
24
24
34
34
44
44
64
64
84
84
104
104
124
124
164
164
204
204
14
14
24
24
34
34
44
44
64
64
84
84
104
104
124
124
164
164
204
204
15
15
25
25
35
35
45
45
65
65
P
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
4
4
T/N2
2.5064
3.6951
1. 1562
1.5623
.74777
.98252
.55207
.71559
.36218
.46326
.26943
.34239
.21449
.27151
. 17815
.22494
.13306
.16748
.10619
.13340
5.4723
7.6114
2.4700
3.1258
1.5845
.19465
1.1649
1.4107
.76090
.90866
.56480
.66987
.44901
.53039
.37261
.43896
.27799
.32640
.22168
.25977
3.8146
5.3980
1.7419
2.2532
1.1230
1. 4127
.82786
1.0277
.54237
.66464
CDF
.949997
.990000
.949993
.990000
.950001
.990000
.950001
.990000
.949999
.990000
.949997
.990000
.950002
.989998
.949996
.989999
.949992
.990001
.950009
.990002
.949998
.990000
.950005
.990000
.950006
.989999
.950006
.990003
.949997
.990000
.950003
.990000
.949997
.990000
.950000
.990000
.950004
.990001
.949991
.989998
.950001
.990000
.950004
.990001
.950008
.989999
.949999
.990003
.950001
.990000
27
Nl
5
5
5
5
5
5
5
5
5
5
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
N2
85
85
105
105
125
125
165
165
205
205
15
15
25
25
35
35
45
45
65
65
85
85
105
105
125
125
165
165
205
205
P
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
T/N2
.40321
.49103
.32087
.38930
.26645
.32248
.19895
.24007
.15874
. 19120
6.3433
8.6636
2.8631
3.5626
1.8384
2.2236
1.3525
1.6140
.88428
1.0416
.65673
.76869
.52228
.60905
.43352
.50430
.32353
.37521
.25806
.29874
CDF
.949996
.990000
.950002
.989999
.950005
.989999
.949998
.990001
.950005
.990001
.950001
.990000
.950001
.990001
.950004
.990002
.949994
.990002
.949999
.990001
.950001
.990000
.949997
.990000
.950002
.990001
.949997
.990000
.950006
.990002