SECTION 12.8 MONTE CARLO INTEGRATION OF NORMAL OVER THE INTERSECTION OF HALF-SPACES (MONCARL)

It is desired to integrate the multivariate normal density over the region given by

i=1,...,k, where the a_{ij} are given numbers. MONCARL accomplishes
this via Monte Carlo integration.

The MAIN program should include

COMMON/BPRINT/IPT,NFILE,NDIG,NPUNCH,JPT,MFILE CALL DFLTThe call to MONCARL is

CALL MONCARL(NREP,NDIM,INDEP,ICONST,A,XMU,SIG,COV,ANS)

where

NREP = the number of samplings NDIM = the dimensionality of the problem (i.e., n in the inequality above) INDEP = a variable declared LOGICAL and set to .TRUE. if the X's are independent and to .FALSE. otherwise ICONST = the number of contraints (i.e., k in the inequality above) A = a DOUBLE PRECISION array dimensioned A(ICONST,0:NDIM) where the column corresponding to column index 0 should contain the right hand sides of the inequalities XMU = a DOUBLE PRECISION array dimensioned XMU(NDIM) containing the mean vector SIG = a DOUBLE PRECISION vector containing the standard deviations of the NDIM variables if INDEP=.TRUE. (SIG is irrelevant if INDEP=.FALSE.) COV = a DOUBLE PRECISION array dimensioned COV(NDIM,NDIM) containing the covariance matrix if INDEP=.FALSE. (COV is irrelevant if INDEP=.TRUE.) ANS = the required integral IER = 0 for normal return, =-67 if the covariance matrix is not positive definite (relevant only if INDEP=.FALSE.)