Program g08acfe

!     G08ACF Example Program Text

!     Mark 26.1 Release. NAG Copyright 2016.

!     .. 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