SUBROUTINE CHIOP(N,S2,ANU,NITER,JFIX,CHI) C This routine draws from N independent chi square distributions, subject C to the restriction that the realizations are monotonically nondescending. C One of the "chi-squares" is fixed at a preset value. C Inputs: C N Number of distributions C S2(Nx1) Constant parameters for distributions C ANU(Nx1) Degrees of freedom parameters for distributions C NITER Number of Gibbs iterations to perform C JFIX Value of (pre-)fixed precision C Input/outputs: C CHI Random vector IMPLICIT REAL*8 (A-H,O-Z) DIMENSION S2(N),ANU(N),CHI(N) N1=N-1 DO 20 ITER=1,NITER IF(JFIX.NE.1)CHI(1)=XCHIT(S2(1),ANU(1),0.0D0,CHI(2),.FALSE.) IF(N.EQ.2)GO TO 20 DO 10 I=2,N1 10 IF(I.NE.JFIX)CHI(I)=XCHIT(S2(I),ANU(I),CHI(I-1),CHI(I+1),.FALSE.) 20 IF(N.NE.JFIX)CHI(N)=XCHIT(S2(N),ANU(N),CHI(N1),-1.0D0,.TRUE.) RETURN END