Program g07eafe

!     G07EAF Example Program Text

!     Mark 26.1 Release. NAG Copyright 2016.

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