    PROGRAM nag_tsa_identify_ex01

      ! Example Program Text for nag_tsa_identify
      ! NAG fl90, Release 4. NAG Copyright 2000.

      ! .. Use Statements ..
      USE nag_tsa_identify, ONLY : nag_tsa_acf, nag_tsa_pacf
      USE nag_examples_io, ONLY : nag_std_in, nag_std_out
      ! .. Implicit None Statement ..
      IMPLICIT NONE
      ! .. Intrinsic Functions ..
      INTRINSIC KIND, SQRT
      ! .. Parameters ..
      INTEGER, PARAMETER :: wp = KIND(1.0D0)
      ! .. Local Scalars ..
      INTEGER :: i, n, na
      ! .. Local Arrays ..
      REAL (wp), ALLOCATABLE :: acf(:), pacf(:), ts(:)
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) &
       'Example Program Results for nag_tsa_identify_ex01'

      READ (nag_std_in,*)          ! Skip heading in data file
      READ (nag_std_in,*) n, na

      ALLOCATE (ts(n),acf(na),pacf(na)) ! Allocate storage

      READ (nag_std_in,*) ts
      ts = SQRT(ts)

      CALL nag_tsa_acf(ts,acf)

      CALL nag_tsa_pacf(acf,pacf)

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) '   lag       acf       pacf'
      WRITE (nag_std_out,*)
      DO i = 1, na
        WRITE (nag_std_out,'(I6,2X,2F10.2)') i, acf(i), pacf(i)
      END DO

      DEALLOCATE (ts,acf,pacf)     ! Deallocate storage

    END PROGRAM nag_tsa_identify_ex01
