    Program g01epfe

!     G01EPF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: g01epf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: d, pdl, pdu
      Integer                          :: ifail, ip, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: work(:)
!     .. Executable Statements ..
      Write (nout,*) 'G01EPF Example Program Results '
      Write (nout,*)

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

!     Read in the problem size
      Read (nin,*) n, ip, d

      Allocate (work(n))

!     Calculate the probability
      ifail = 0
      Call g01epf(n,ip,d,pdl,pdu,work,ifail)

!     Display results
      Write (nout,99999) ' Durbin-Watson statistic ', d
      Write (nout,*)
      Write (nout,99998) ' Probability for the lower bound = ', pdl
      Write (nout,99998) ' Probability for the upper bound = ', pdu

99999 Format (1X,A,F10.4)
99998 Format (1X,A,F10.4)
    End Program g01epfe
