* G08EBF Example Program Text * Mark 22 Revised. NAG Copyright 2006. * .. Parameters .. INTEGER NOUT PARAMETER (NOUT=6) INTEGER N, MSIZE, LAG, LDC, MSTATE, MSEED PARAMETER (N=1000,MSIZE=10,LAG=1,LDC=10,MSTATE=200,MSEED=1) * .. Local Scalars .. DOUBLE PRECISION CHI, DF, EX, PROB INTEGER GENID, I, IFAIL, IFAIL2, IFLGF, LSEED, LSTATE, + SUBID CHARACTER CL * .. Local Arrays .. DOUBLE PRECISION WRK(2*LAG), X(N) INTEGER NCOUNT(LDC,MSIZE), SEED(MSEED), STATE(MSTATE) * .. External Subroutines .. EXTERNAL G05KFF, G05SQF, G08EBF, X04EAF * .. Executable Statements .. WRITE (NOUT,*) 'G08EBF Example Program Results' * IFLGF = 0 * GENID and SUBID identify the base generator GENID = 1 SUBID = 1 * Initialize the seed SEED(1) = 438532 * 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 G08EBF(CL,N,X,MSIZE,LAG,NCOUNT,LDC,EX,CHI,DF,PROB,WRK, + IFAIL) * IF (CL.NE.'L' .AND. CL.NE.'l' .AND. IFAIL.NE.0) GO TO 40 * 20 CONTINUE IF (IFAIL.EQ.0 .OR. IFAIL.EQ.8) THEN WRITE (NOUT,*) IFAIL2 = 0 * * Print the count matrix CALL X04EAF('General',' ',MSIZE,MSIZE,NCOUNT,LDC, + 'Count matrix',IFAIL2) * WRITE (NOUT,*) WRITE (NOUT,99999) 'Expected value = ', EX WRITE (NOUT,99998) 'CHISQ = ', CHI WRITE (NOUT,99999) 'DF = ', DF WRITE (NOUT,99998) 'Probability = ', PROB IF (IFAIL.EQ.8) WRITE (NOUT,*) + ' ** Note : the chi square approximation may not be very good.' END IF 40 CONTINUE * 99999 FORMAT (1X,A,F8.2) 99998 FORMAT (1X,A,F10.4) END