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

NAG FL Interface Introduction
Example description
    Program g07dafe

!     G07DAF Example Program Text

!     Mark 30.1 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: g07daf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: xmd, xme, xsd
      Integer                          :: ifail, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: x(:), y(:)
!     .. Executable Statements ..
      Write (nout,*) 'G07DAF Example Program Results'
      Write (nout,*)

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

!     Read in problem size
      Read (nin,*) n

      Allocate (x(n),y(n))

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

!     Calculate robust summaries
      ifail = 0
      Call g07daf(n,x,y,xme,xmd,xsd,ifail)

!     Display results
      Write (nout,*) 'Original Data'
      Write (nout,99999) x(1:n)
      Write (nout,*)
      Write (nout,*) 'Sorted Data'
      Write (nout,99999) y(1:n)
      Write (nout,*)
      Write (nout,99998) 'Median                             = ', xme
      Write (nout,99998) 'Median absolute deviation          = ', xmd
      Write (nout,99998) 'Robust estimate standard deviation = ', xsd

99999 Format (1X,11F7.3)
99998 Format (1X,A,F6.3)
    End Program g07dafe