    PROGRAM g07eafe

!      G07EAF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : g07eaf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: clevel, estcl, theta, thetal,        &
                                          thetau, wlower, wupper
       INTEGER                         :: ifail, n
       CHARACTER (1)                   :: method
!      .. Local Arrays ..
       REAL (KIND=nag_wp), ALLOCATABLE :: wrk(:), x(:)
       INTEGER, ALLOCATABLE            :: iwrk(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'G07EAF Example Program Results'
       WRITE (nout,*)

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

!      Read in problem size and CI level
       READ (nin,*) method, n, clevel

       ALLOCATE (x(n),wrk(4*n),iwrk(3*n))

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

!      Calculate statistics
       ifail = 0
       CALL g07eaf(method,n,x,clevel,theta,thetal,thetau,estcl,wlower,wupper, &
          wrk,iwrk,ifail)

!      Display results
       WRITE (nout,*) ' Location estimator     Confidence Interval '
       WRITE (nout,*)
       WRITE (nout,99999) theta, '(', thetal, ' ,', thetau, ' )'
       WRITE (nout,*)
       WRITE (nout,*) ' Corresponding Wilcoxon statistics'
       WRITE (nout,*)
       WRITE (nout,99998) 'Lower : ', wlower
       WRITE (nout,99998) 'Upper : ', wupper

99999  FORMAT (3X,F10.4,12X,A,F7.4,A,F7.4,A)
99998  FORMAT (1X,A,F8.2)
    END PROGRAM g07eafe
