NAG Library Manual, Mark 30
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program g01adfe

!     G01ADF Example Program Text

!     Mark 30.0 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: g01adf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: s2, s3, s4, xmean
      Integer                          :: i, ifail, k, kmin1, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: x(:)
      Integer, Allocatable             :: ifreq(:)
!     .. Executable Statements ..
      Write (nout,*) 'G01ADF Example Program Results'
      Write (nout,*)

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

!     Read in the problem size
      Read (nin,*) kmin1
      k = kmin1 + 1

      Allocate (ifreq(k),x(k))

!     Read in data
      Read (nin,*)(x(i),ifreq(i),i=1,kmin1), x(k)

!     Calculate summary statistics
      ifail = 0
      Call g01adf(k,x,ifreq,xmean,s2,s3,s4,n,ifail)

!     Display results
      Write (nout,99999) 'Number of classes ', kmin1
      Write (nout,*)
      Write (nout,*) '          Class          Frequency'
      Write (nout,*)
      Write (nout,99998)(x(i),x(i+1),ifreq(i),i=1,kmin1)
      Write (nout,*)
      Write (nout,99997) ' Mean ', xmean
      Write (nout,99996) ' Std devn', s2
      Write (nout,99996) ' Skewness', s3
      Write (nout,99996) ' Kurtosis', s4
      Write (nout,99995) ' Number of cases', n

99999 Format (1X,A,I4)
99998 Format (1X,2F10.2,I12)
99997 Format (1X,A,F16.4)
99996 Format (1X,A,F13.4)
99995 Format (1X,A,I8)
    End Program g01adfe