    PROGRAM g08acfe

!      G08ACF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : g08acf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: p
       INTEGER                         :: i1, i2, ifail, n, n1
!      .. Local Arrays ..
       REAL (KIND=nag_wp), ALLOCATABLE :: w(:), x(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'G08ACF Example Program Results'
       WRITE (nout,*)

!      Skip heading in data file
       READ (nin,*)

!      Read in problem size
       READ (nin,*) n, n1

       ALLOCATE (x(n),w(n))

!      Read in data
       READ (nin,*) x(1:n)

!      Display title
       WRITE (nout,*) 'Median test'
       WRITE (nout,*)

!      Output data
       WRITE (nout,*) 'Data values'
       WRITE (nout,*)
       WRITE (nout,99999) '    Group 1  ', x(1:n1)
       WRITE (nout,*)
       WRITE (nout,99999) '    Group 2  ', x((n1+1):n)

!      Perform median test
       ifail = 0
       CALL g08acf(x,n,n1,w,i1,i2,p,ifail)

!      Display results
       WRITE (nout,*)
       WRITE (nout,99998) i1, ' scores below median in group 1'
       WRITE (nout,99998) i2, ' scores below median in group 2'
       WRITE (nout,*)
       WRITE (nout,99997) '     Significance  ', p

99999  FORMAT (1X,A,8F4.0/(14X,8F4.0))
99998  FORMAT (1X,I6,A)
99997  FORMAT (1X,A,F8.5)
    END PROGRAM g08acfe
