PROGRAM g08cbfe ! G08CBF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : g08cbf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: d, p, z INTEGER :: ifail, n, npar, ntype CHARACTER (1) :: dist, estima ! .. Local Arrays .. REAL (KIND=nag_wp) :: par(2) REAL (KIND=nag_wp), ALLOCATABLE :: sx(:), x(:) ! .. Executable Statements .. WRITE (nout,*) 'G08CBF Example Program Results' WRITE (nout,*) ! Skip heading in data file READ (nin,*) ! Read in problem size and the statistic to calculate READ (nin,*) n, ntype ALLOCATE (x(n),sx(n)) ! Read in data READ (nin,*) x(1:n) ! Read in information on the distribution to test against READ (nin,*) dist, estima SELECT CASE (dist) CASE ('P','p','E','e') npar = 1 CASE DEFAULT npar = 2 END SELECT ! Read in the distribution parameters if required ! otherwise they are estimated from the data by G08CBF ! and PAR need not be set IF (estima=='S' .OR. estima=='s') THEN READ (nin,*) par(1:npar) ELSE IF (dist=='B' .OR. dist=='b') THEN ! Read in M for the binomial distribution READ (nin,*) par(1) END IF ! Perform K-S test ifail = 0 CALL g08cbf(n,x,dist,par,estima,ntype,d,z,p,sx,ifail) ! Display results WRITE (nout,*) 'K-S Test' WRITE (nout,*) 'Distribution: ', dist WRITE (nout,99999) 'Parameters : ', par(1:npar) WRITE (nout,*) WRITE (nout,99999) 'Test statistic D = ', d WRITE (nout,99999) 'Z statistic = ', z WRITE (nout,99999) 'Tail probability = ', p 99999 FORMAT (1X,A,2F8.4) END PROGRAM g08cbfe