	PROGRAM D13R18
C	Driver for routine KENDL1
C	Look for correlations in RAN0 ... RAN4
	PARAMETER(NDAT=200)
	DIMENSION DATA1(NDAT),DATA2(NDAT)
	CHARACTER TEXT(5)*4
	DATA TEXT/'RAN0','RAN1','RAN2','RAN3','RAN4'/
	WRITE(*,'(/1X,A/)') 'Pair correlations of RAN0 ... RAN4'
	WRITE(*,'(2X,A,T16,A,T34,A,T50,A,/)')
     *		'Program','Kendall Tau','Std. Dev.','Probability'
	DO 12 I=1,5
		IDUM=-1357
		DO 11 J=1,NDAT
			IF (I.EQ.1) THEN
				DATA1(J)=RAN0(IDUM)
				DATA2(J)=RAN0(IDUM)
			ELSE IF (I.EQ.2) THEN
				DATA1(J)=RAN1(IDUM)
				DATA2(J)=RAN1(IDUM)
			ELSE IF (I.EQ.3) THEN
				DATA1(J)=RAN2(IDUM)
				DATA2(J)=RAN2(IDUM)
			ELSE IF (I.EQ.4) THEN
				DATA1(J)=RAN3(IDUM)
				DATA2(J)=RAN3(IDUM)
			ELSE IF (I.EQ.5) THEN
				DATA1(J)=RAN4(IDUM)
				DATA2(J)=RAN4(IDUM)
			ENDIF
11		CONTINUE
		CALL KENDL1(DATA1,DATA2,NDAT,TAU,Z,PROB)
		WRITE(*,'(1X,T4,A,3F17.6)') TEXT(I),TAU,Z,PROB
12	CONTINUE
	END
	PROGRAM D13R19
C	Driver for routine KENDL2
C	Look for 'ones-after-zeros' in IRBIT1 and IRBIT2 sequences
	PARAMETER(NDAT=1000,IP=8,JP=8)
	DIMENSION TAB(IP,JP)
	CHARACTER TEXT(8)*3
	DATA TEXT/'000','001','010','011','100','101','110','111'/
	WRITE(*,*) 'Are ones followed by zeros and vice-versa?'
	I=IP
	J=JP
	DO 17 IFUNC=1,2
		ISEED=2468
		WRITE(*,'(/1X,A,I1/)') 'Test of IRBIT',IFUNC
		DO 12 K=1,I
			DO 11 L=1,J
				TAB(K,L)=0.0
11			CONTINUE
12		CONTINUE
		DO 15 M=1,NDAT
			K=1
			DO 13 N=0,2
				IF (IFUNC.EQ.1) THEN
					K=K+IRBIT1(ISEED)*(2**N)
				ELSE 
					K=K+IRBIT2(ISEED)*(2**N)
				ENDIF
13  			CONTINUE
			L=1
			DO 14 N=0,2
				IF (IFUNC.EQ.1) THEN	
					L=L+IRBIT1(ISEED)*(2**N)
				ELSE 
					L=L+IRBIT2(ISEED)*(2**N)
				ENDIF
14			CONTINUE
			TAB(K,L)=TAB(K,L)+1.0
15		CONTINUE
		CALL KENDL2(TAB,I,J,IP,JP,TAU,Z,PROB)
		WRITE(*,'(4X,8A6/)') (TEXT(N),N=1,8)
		DO 16 N=1,8
			WRITE(*,'(1X,A,8I6)') TEXT(N),(NINT(TAB(N,M)),M=1,8)
16		CONTINUE
		WRITE(*,'(/7X,A,T24,A,T38,A)') 'Kendall Tau','Std. Dev.',
     * 			'Probability'
		WRITE(*,'(1X,3F15.6/)') TAU,Z,PROB
		WRITE(*,*) 'Press RETURN to continue ...'
		READ(*,*)
17	CONTINUE
	END
	PROGRAM D13R10
C	Driver for routine KSONE
	PARAMETER(NPTS=1000,EPS=0.1)
	DIMENSION DATA(NPTS)
	EXTERNAL FUNC
	IDUM=-5
	WRITE(*,'(/1X,T5,A,T24,A,T44,A/)')
     *			'Variance Ratio','K-S Statistic','Probability'
	DO 12 I=1,11
		VAR=1.0+(I-1)*EPS
		FACTR=SQRT(VAR)
		DO 11 J=1,NPTS
			DATA(J)=FACTR*ABS(GASDEV(IDUM))
11		CONTINUE
		CALL KSONE(DATA,NPTS,FUNC,D,PROB)
		WRITE(*,'(1X,F14.6,F18.6,E20.4)') VAR,D,PROB
12	CONTINUE
	END

	FUNCTION FUNC(X)
	Y=X/SQRT(2.0)	
	FUNC=ERF(Y)
	END
	PROGRAM D13R11
C	Driver for routine KSTWO
	PARAMETER(N1=2000,N2=1000,EPS=0.1)
	DIMENSION DATA1(N1),DATA2(N2)
	IDUM=-1357
	DO 11 J=1,N1
		DATA1(J)=GASDEV(IDUM)
11	CONTINUE
	WRITE(*,'(/1X,T6,A,T26,A,T46,A/)')
     *		'Variance Ratio','K-S Statistic','Probability'
	IDUM=-2468
	DO 13 I=1,11
		VAR=1.0+(I-1)*EPS
		FACTR=SQRT(VAR)
		DO 12 J=1,N2
			DATA2(J)=FACTR*GASDEV(IDUM)
12		CONTINUE
		CALL KSTWO(DATA1,N1,DATA2,N2,D,PROB)
		WRITE(*,'(1X,F15.6,F19.6,E20.4)') VAR,D,PROB
13	CONTINUE
	END
