Numerical Computation of Multivariate Normal and Multivariate t Probabilities over Ellipsoidal Regions

An algorithm for the computation of multivariate normal and multivariate t probabilities over general hyperellipsoidal regions is given. A special case is the calculation of probabilities for central and noncentral F and x2 distributions. A FORTRAN 90 program MVELPS.FOR incorporates the algorithm.


INTRODUCTION
developed procedures for calculation of the multivariate normal and multivariate-t distributions over convex regions bounded by hyperplanes. This paper extends the procedures to general ellipsoidal regions. There are a number of potential applications. One is in the field of reliability, and in particular relating to the computation of tolerance factors for multivariate normal populations.  discussed a number of approximation methods in the their calculation. Another relates to the calculation of probabilities for linear combinations of central and noncentral chisquare and F. Again a number of authors, including Farebrother (1990) have studied the problem. A number of approximation methods exist, including those of Satterthwaite-Welsh, Satterthwaite, F.E. (1946) and Hall-Buckley-Eagleson, Buckley, M. J. and Eagleson, G. K. (1988). Other potential applications are in factor and discriminant analysis.
The program, of course, can also be used for the special case of calculating probabilities for a central or noncentral chisquare or F distribution.

EVALUATION OF MULTIVARIATE-T AND MULTIVARIATE NORMAL INTEGRALS
Let x T = (x 1 , x 2 , ... ,x k ) have the distribution f(x) = MVN(µ µ µ µ, Σσ 2 ), where Σ is a known positive definite matrix and σ 2 is a constant. We wish to evaluate f(x) over A, an ellipsoidal region given by (x -m*) T U (x -m*) = 1. That is, we wish to obtain P = ∫ A f(x) dx.
If σ 2 is estimated by s 2 with ν degrees of freedom such that νs 2 / σ 2 is a chi-square variate, then, without loss of generality we may assume f(x) has the central multivariate-t distribution and Σ is the correlation matrix.
Let Σ = TT T (Cholesky decomposition) and set x = T w. The random variables w 1 , w 2 , ... ,w k are independent standard normal or spherically symmetric t variables. Without loss of generality we may assume that the axes of the ellipsoid are parallel to the coordinate axes and the ellipsoid has the equation (w -m) T B -1 (w -m) = 1.
(2.1) where B is a diagonal matrix with diagonal elements given by b i .
If the elements b i are equal, we have the special case of a spheroidal region. (We show in section 5. that evaluation of multivariate normal and multivariate t distributions over spheroidal regions is equivalent to evaluating noncentral chisquare and noncentral F distributions respectively.) Case a) σ 2 is known (Multivariate Normal) Let r 2 = w T w. Since σ 2 is known, r 2 is distributed as chi-square with k degrees of freedom. The procedure is to choose random directions in the w coordinate system (say mocar of them). Using the "nonbinning" or "direct" method, an unbiased estimate of the probability content corresponding to each direction is obtained based on the distance of the boundary of the ellipsoid from the origin. Their arithmetic mean is an estimate of the probability content. To obtain a standard error, the process is repeated (say irep times), and a standard error calculated for the mean of the means.
Using the binning method, an empirical estimate of the distribution of the distances is obtained, and quadrature is used to estimate the probability content of the ellipsoid. As before, the process is repeated so as to provide a standard error. i) "Nonbinning" method: If the ellipsoid contains the origin, then for each random direction there is a unique distance (say r(i)) to the boundary. An unbiased estimate of the probability content of the ellipsoid is given by Pr[r < r(i)] = Pr[χ 2 < (r(i)) 2 ]. If P(σ) is the probability content of the ellipsoid when σ is assumed known, then P(σ) ≈ Σ Pr[χ 2 < r(i) 2 ]/N where N is the number of unbiased estimates.
If the ellipsoid does not contain the origin, then for a random direction, a line from the origin in that direction intersects the boundary of the ellipsoid in two points (say r(i) > r*(i)) or does not intersect the ellipsoid. If the line intersects the boundary, then an unbiased estimate of the probability content of the ellipsoid is given by Pr[r < r(i)] -Pr[r < r*(i)] = Pr[χ 2 < r(i) 2 ] -Pr[χ 2 < r*(i) 2 ]. If the line does not intersect the ellipsoid, an unbiased estimate is 0. For N unbiased estimates, P(σ) ≈ Σ {Pr[χ 2 < r(i) 2 ] -Pr[χ 2 < r*(i) 2 ]}/N where the summation is over all cases where the line intersects the boundary.
In both cases it is convenient to let N = 2 * mocar where having chosen a random direction we use also the opposite direction.
ii) "Binning" method: For the case where the origin is in the ellipsoid, let H(r) be the cumulative distribution function of r, the distance from the origin to the boundary in a randomly chosen direction. The probability content of the ellipsoid is P(σ) = ∫ a b (1-H(r)) Pr[χ 2 < r 2 ] dr + Pr[χ 2 < a 2 ] where a and b are respectively the smallest and largest distances of the boundary of the ellipsoid from the origin. Using Gauss-Legendre quadrature, P(σ) ≈ Σ wt i (1-H(r i )) Pr[χ 2 < r i 2 ] + Pr[χ 2 < a 2 ] where r i and wt i are the abscissae and weights respectively for the Gauss-Legendre quadrature and the values r i are used in the binning process to obtain the empirical estimates H(r i ) of the cumulative distribution function of r.
If the origin is not in the ellipsoid, P(σ) = p 1 [ ∫ a b (1-H 1 (r)) Pr[χ 2 < r 2 ] dr -∫ a b (1-H2(r)) Pr[χ 2 < r 2 ] dr] = p 1 [ ∫ a b {H 2 (r) -H 1 (r)} * Pr[χ 2 < r 2 ] dr] where p 1 is the probability that a line through the origin in a random direction goes through the ellipsoid, and H 1 (r) and H 2 (r) are respectively the cumulative distribution functions of the larger and smaller distances from the origin to the boundary for intersecting lines. Using Gauss-Legendre quadrature we obtain P(σ) ≈ p 1 Σ wt i {H 2 (r i ) -H 1 (r i )} * Pr[χ 2 < r i 2 ]. where r i and wt i are the abscissae and weights respectively for the Gauss-Legendre quadrature and the values for r i are used in the binning process to obtain the empirical estimates H 1 (r i ) and H 2 (r i ) of the cumulative distribution functions H 1 (r) and H 2 (r). The value p 1 is simultaneously estimated. Again mocar random directions are used for the estimates H 1 (r i ) and H 2 (r i ). The procedure is repeated irep times, with the estimate of P being the mean of the irep estimates, and the repetitions used to obtain a standard error.
We summarize the results for the case where σ is known in the following Table 2.1: The ellipsoid is given by (w -m) T B -1 (w -m) = 1. Suppose s = σ. Then the probability content of the ellipsoid is P(σ) as given in the previous section. Let g(s) be the frequency function for s (νs 2 / σ 2 has the χ 2 distribution with ν degrees of freedom). Then the unconditional probability content of the ellipsoid is given by P = ∫ 0 ∞ P(s) g(s) ds.
Using Gauss-Laguerre quadrature, we obtain P ≈ Σ wg i * P(s i ) * g(s i ) where s i and wg i are the quadrature abscissae and weights respectively. We use the formulae for P(σ) given in the table above.

DISTANCE OF ORIGIN FROM BOUNDARY
If the equation of the ellipsoidal region is given by (w -m) T B -1 (w -m) < g, then the origin will be in the region if m T B -1 m -g < 0. Let d be a random (normalized) direction. Then the equation of the line from the origin in the direction d is given by w = t d. Substituting in the equation for the ellipsoidal boundary we obtain t 2 aa -2 t bb + cc = 0 where aa = d T B -1 d, bb = m T B -1 d and cc= m T B -1 m -g. Let b2ac = bb * bb -aa * cc. Then, if the origin is in the ellipsoid, the distances from the origin to the ellipsoid boundary in the directions d and -d are |bb + sqrt(b2ac)| and |bb -sqrt(b2ac)|. If the origin is not in the ellipsoid, then if b2ac < 0, for both directions d and -d the line does not cross the ellipsoid. If b2ac > 0, the line crosses the boundary in one of the directions d or -d at distances from the origin r(i) = |bb| + sqrt(b2ac) and r*(i) = ||bb| -sqrt(b2ac)|. The line does not cross the boundary in the other direction.

EXTREMAL DISTANCES FROM ORIGIN TO BOUNDARY
The author has written a Fortran 90 program to calculate the largest and smallest distances from the origin to a general hyper-ellipsoid in k dimensions. The program is called BOUND.FOR and a paper describing the program will be submitted for publication. The program can also be used to find all local extrema which may exist. The present program MVELPS.FOR uses the program BOUND.FOR as a subroutine.

NONCENTRAL CHISQUARE AND F PROBABILITIES
The methodology can be used to obtain cumulative probabilities for chisquare and F distributions. If w is MVN(0, I) with dimension k, and u has the noncentral chisquare distribution with k degrees of freedom and noncentrality parameter λ, it is not difficult to show that Pr[u < f0] is equal to the probability content of w over a spheroid with radius sqrt(f0) and center a distance λ from the origin.
We now modify our procedure for the special case of calculating noncentral chisquare probabilities. Without loss of generality, let λ λ λ λ = (λ, 0, ... ,0). Then Pr[χ 2 (λ) < c] = Pr[Σw i 2 + 2 λ w 1 + λ 2 -f0 < 0]. Let d be a random (normalized) direction in the k-space, and set w i = t d. To find the intersection of this line with the spheroid boundary, we substitute w i = t d in Σw i 2 + 2 λ w 1 + λ 2 -f0 = 0 obtaining t 2 + 2 λ d 1 t + λ 2 -f0 = 0. Solving for t, we have t = -λ d 1 + sqrt(λ 2 d 1 2 -(λ 2 − f0)). When λ 2 -f0 < 0, the origin is in the spheroid. If the origin is not in the spheroid, and λ 2 d 1 2 -(λ 2 − f0) > 0, the line crosses the boundary of the spheroid in two points. If the origin is not in the spheroid, and λ 2 d 1 2 -(λ 2 − f0) < 0, the line does not cross the boundary. The distance from the origin to the boundary is |t|. Since only one component, d 1 , of d is used in computing t, the program uses each element of d and also its negative (total of 2*k) as d 1 as a means of increasing efficiency.
We next modify the procedure for the special case of calculating noncentral F probabilities. Suppose s 2 is an estimate of σ 2 (assumed to be equal to 1 with no loss of generality) with ν degrees of freedom such that ν s 2 / σ 2 has the χ 2 distribution. Then using Theorem 5.4.1 of Anderson (1984), F(k, ν; λ) = (z T z /k) / ([ν s 2 / σ 2 ]/ ν = (z T z /k) / s 2 has the noncentral F distribution with degrees of freedom k and ν, and noncentrality parameter λ. Thus F(k, ν; λ) = Σ(w i + λ i ) 2 /(k s 2 ), and Pr[F(k, ν; λ) < c| s 2 ] = Pr[Σ(w i + λ i ) 2 < c k s 2 |s]. This is the probability content of a spheroid with center a distance λ from the origin and with radius sqrt(c * k * s 2 ), for any fixed value of s. To obtain the unconditional probability, we integrate over s Pr[F(k, ν; λ) < c] = ∫ Pr[F(k, ν; λ) < c| s] g(s) ds where g(s) is the frequency function for s, and the integration is from 0 to ∞. Having a procedure for calculating Pr[F(k, ν; λ) < c| s] (noncentral χ 2 ), it is convenient to use Gauss Laguerre quadrature to calculate the unconditional probability.
The program MVELPS.FOR has a special shortcut for calculation of noncentral chisquare and F distribution probabilities which takes advantage of the special case of a spheroidal region. There are existing programs for the above distributions and no claims are made as to the superiority or inferiority of any of the programs.

ACCURACY AND COMPUTATION TIMES
To assess the accuracies attainable using MVELPS.FOR, runs were made for k = 3, 6 and 10, with ellipsoid centers both inside and outside of the ellipsoidal region, and for both the multivariate normal and the multivariate-t distribution. The lengths of the semiaxes and centers, in standardized units are given in Table 6.1. All runs were made using a PC with an AMD 800 processor and a Lahey 95 compiler. k = 3 k = 6 k = 10 Axes (4,2,1) (1,2,2,3,3,4) (1,2,2,2,2,3,3,3,3,4) Center (inside) (0,1,0) (0,2,0,0,0,0) (0,1,0,0,0,0,0,0,0,0) Center (outside) (0,3,0) (0,3,0,0,0,0) (0,3,0,0,0,0,0,0,0,0) Table 6.1 Input for Accuracy Runs Using 10 replications, each with 1000 random directions, runs were made using both the binning and nonbinning methods. For the binning procedure 20 point quadrature was used for both Gauss-Legendre and Gauss-Laguerre. Standard errors were essentially the same for the binning and nonbinning methods. To ascertain the effect of run size on standard error and running times, further runs were made with result given in Table 6.3. 20 points were used for both Gauss-Legendre and Gauss-Laguerre quadrature for the binning procedure. Semiaxes of (4,2,1) with center (0,1,0) for k = 3 were used. Regression analyses showed near perfect linear relationships between running times and number of random directions, and between the logarithms of standard errors and number of random directions. For example, for the binning procedure, the approximate linear relationship between running time and number of random directions is time = .00316 + 5.78E-6 * (# random directions). It may be noted that except for total random directions of 1000 for the multivariate normal case, the binning procedure consistently requires less running time than the nonbinning procedure. The binning procedure is thus recommended.
It needs to be emphasized that the standard error of the estimate is a function of the shape and position of the ellipsoid (after the "standardizing" transformations). If the ellipsoid is a spheroid centered at the origin, the accuracy is independent of the number of random directions and is a function of the processor and the computer program. The standard error, in general, is a function of the degree of departure of the ellipsoid from a spheroid centered at the origin.
Special runs were made to ascertain the accuracy and running times of the shortcut method for the noncentral F distribution. A total of 180 runs were made, with k = 2, 3, 5, 10 and 20, λ and f0 equal to .1, .2, .5, 1, 2, 5 and 10. For each run, 10 estimates, each using 1000 random directions were used. The estimates and standard errors were consistent with existing software programs, e.g. from the M. D. Anderson Cancer Center Statistical Archives (see also http://www.stat.ucla.edu/ statistical calculator). Some results follow. When λ 2 − f0 was less than zero (axes origin was inside ellipsoid), the largest standard error estimate was .0001 (estimated probability of .804650 for λ = 2 and f0 = 5). When λ 2 − f0 was greater than zero (axes origin was outside ellipsoid), the largest estimated standard error was .000584 (estimated probability of .059056 for k = 2, λ = 1 and f0 = .1). Of the 57 cases where the estimated probability was greater than .5, and λ 2 − f0 was less than zero, 42 cases had estimated standard errors less than 10 -6 . Estimated standard error tended to decrease both for increasing values of k and increasing values for the estimated probability. The ratio of the estimated standard error divided by the estimated probability tended to increase with increasing values of λ 2 − f0 and decrease with increasing values of the estimated probability.
Average running times ranged from 0.075 and .109 seconds for k= 2 and 3 respectively to .379 and .843 seconds for k=10 and 20 respectively.
The same runs were made for the noncentral chisquare with modestly higher estimated accuracies and modestly smaller running times.
Running times and accuracies for the general ellisoid case should be well approximated by those for the special spheroid case above. Some examples are given in section 8.

USING MVELPS.FOR
MVELPS.FOR is a FORTRAN 90 program which calculates the probability content of a general ellipsoid: . The element σ 2 may be known or estimated with ν ν ν ν degrees of freedom. The program requires that the files ELIP.IN and ELIP.OUT exist before the program is run. ELIP.IN contains the required input parameters and the program returns the output from the program in the file ELIP.OUT.
Except for the "shortcut method" used for the special case of calculation of noncentral χ 2 and noncentral F probabilities (described later), the file ELIP.IN requires six "lines" of input. A "line" may actually be a vector or matrix. The six "lines" are: LINE 1: k seed ν mocar irep meth LINE 2: ellipg LINE 3: Σ LINE 4: µ µ µ µ LINE 5: U LINE 6: m * LINES 1 and 2: The elements k, mocar, irep and ellipg have already been discussed. The degrees of freedom ν for the estimate of σ σ σ σ 2 is given the value "-1" when σ σ σ σ 2 is assumed to be known. The seed for the random generator is "seed". To calculate the probability using the binning method, set "meth" = 1. To calculate the probability using the non-binning or direct method, set "meth" = 0.
LINES 3 and 5: Σ and U are symmetric matrices. It is permissible to input only the lower triangular portion of these matrices. Each row occupies a separate line.
If a matrix is a diagonal with all diagonal elements equal to "d", then one line containing the single element "-d" is sufficient.
LINES 4 and 6: The k elements of the vector make up the line.
The "shortcut method", used for calculating noncentral χ 2 and noncentral F probabilities, requires two lines: LINE 1: k seed ν mocar irep meth LINE 2: λ f0. LINE 1 is the same as before, except that now "meth" is set to -1. The noncentrality parameter λ has previously been defined, and f0 is the upper limit of the noncentral χ 2 or noncentral F function as in Prob[ F < f0].
ELIP.IN can contain several sets of instructions. After the last set of instructions, the program expects a line of four or more -1's.

EXAMPLES
Example 1. Let x have the multivariate t distribution with k = 3, all correlations equal to .5, mean vector 0, and with 20 degrees of freedom. We want to find the probability content of the ellipsoidal region (xm*) T U (xm*) = 1, where U is a diagonal matrix with diagonal (.25, .2, .1) and m* is (1, .5, .25). Choose 357 as seed and make 10 preliminary estimates each using 10,000 random directions. We would like to first use the binning method and then the nonbinning method. ELIP.IN could be as follows: The output from ELIP.OUT is: date and time 20010620222230.650 Binning method used elapsed time in seconds is .050 no of pops is 4 seed is 297 variance assumed known no of random dir. is 2000.000000 value of integral is calculated 10 times mean value is 3.08498234E-01 standard error of mean is 6.20856299E-04 --------------------Example 3 Find Pr [F < 3] where F is the noncentral F distribution with degrees of freedom 4 and 25 for the numerator and denominator respectively, and the noncentrality parameter is 1.2. Make 12 estimates with 1200 random directions each. ELIP.IN may be given by 4 9133 25 1200 12 -1 1.2 3 -1 -1 -1 -1 -1 -1 The output from ELIP.OUT is: Noncentrality parameter is 1.200000 date and time 20010620222230.700 elapsed time in seconds is .220 no of pops is 4 seed is 9133 df for var est is 25 value of integral is calculated 12 times mean value is .905823290 standard error of mean is 9.21626452E-06 --------------------Example 4 Find Pr[χ 2 < 2.5 ] where χ 2 is the noncentral chisquare distribution with 5 degrees of freedom and noncentrality parameter 1.6. Use a single estimate (no error estimate will be given) with 10,000 random directions. ELIP.IN may be given by 5 9571 -1 10000 1 -1 1.6 2.5 The output from ELIP.OUT is: Noncentrality parameter is 1.600000 date and time 20010620222230.920 elapsed time in seconds is .110 no of pops is 5 seed is 9571 variance assumed known no of random dir. is 100000.000000 value of integral is calculated 1 times mean value is 9.27048028E-02 --------------------

SUMMARY AND CONCLUSIONS
A methodology has been developed and a Fortran 90 program written to find the probability content of an hyperellipsoid when the underlying distribution is multivariate normal or multivariate-t. The methodology has been used by the author for two applications. In the computation of tolerance factors for multivariate populations there are four parameters: N, α, β and γ ). The author is writing a Fortran 90 program which will be submitted for publication which calculates any one of the four parameters, given the other three. The author has a Fortran 90 program in an advanced state of development which calculates cumulative probabilities for linear combinations of central and noncentral linear combinations of chisquare and F. The present program (MVELPS) can be used to calculate probabilites for the special case where the ellipsoids are actually spheroids, namely for central noncentral F and χ 2 distributions. No claims are made regarding superiority or inferiority to other existing programs for this case.