* G08ECF Example Program Text * Mark 22 Revised. NAG Copyright 2006. * .. Parameters .. INTEGER NOUT PARAMETER (NOUT=6) INTEGER N, MSIZE, LDC, MSTATE, MSEED PARAMETER (N=1000,MSIZE=5,LDC=5,MSTATE=200,MSEED=1) * .. Local Scalars .. DOUBLE PRECISION CHI, DF, EX, PROB INTEGER GENID, I, IFAIL, IFLGF, J, K, LSEED, LSTATE, + SUBID CHARACTER CL * .. Local Arrays .. DOUBLE PRECISION X(N) INTEGER NCOUNT(LDC,LDC,MSIZE), SEED(MSEED), STATE(MSTATE) * .. External Subroutines .. EXTERNAL G05KFF, G05SQF, G08ECF * .. Executable Statements .. WRITE (NOUT,*) 'G08ECF Example Program Results' * IFLGF = 0 * GENID and SUBID identify the base generator GENID = 1 SUBID = 1 * Initialize the seed SEED(1) = 32423 * Initialize the generator to a repeatable sequence LSTATE = MSTATE LSEED = MSEED CALL G05KFF(GENID,SUBID,SEED,LSEED,STATE,LSTATE,IFLGF) * DO 20 I = 1, 10 * Generate some U(0,1) variates CALL G05SQF(N,0.0D0,1.0D0,STATE,X,IFLGF) * IF (I.EQ.1) THEN CL = 'F' ELSE IF (I.EQ.10) THEN CL = 'L' ELSE CL = 'I' END IF * IFAIL = -1 * CALL G08ECF(CL,N,X,MSIZE,NCOUNT,LDC,EX,CHI,DF,PROB,IFAIL) * IF (CL.NE.'L' .AND. CL.NE.'l' .AND. IFAIL.NE.0) GO TO 80 * 20 CONTINUE * IF (IFAIL.EQ.0 .OR. IFAIL.EQ.7) THEN WRITE (NOUT,*) WRITE (NOUT,*) 'Count matrix' DO 60 I = 1, MSIZE WRITE (NOUT,*) WRITE (NOUT,99999) 'I = ', I WRITE (NOUT,*) ' 1 2 3 4 5' WRITE (NOUT,*) DO 40 J = 1, MSIZE WRITE (NOUT,99998) J, (NCOUNT(I,J,K),K=1,MSIZE) 40 CONTINUE 60 CONTINUE WRITE (NOUT,*) WRITE (NOUT,99997) 'Expected value = ', EX WRITE (NOUT,99996) 'CHISQ = ', CHI WRITE (NOUT,99997) 'DF = ', DF WRITE (NOUT,99996) 'Prob = ', PROB IF (IFAIL.EQ.7) WRITE (NOUT,*) + ' ** Note : the chi square approximation may not be very good.' END IF 80 CONTINUE * 99999 FORMAT (1X,A,I2) 99998 FORMAT (1X,I2,5I7) 99997 FORMAT (1X,A,F8.2) 99996 FORMAT (1X,A,F10.4) END