! G13DNF Example Program Text ! Mark 23 Release. NAG Copyright 2011. MODULE g13dnfe_mod ! G13DNF Example Program Module: ! Parameters and User-defined Routines ! .. Use Statements .. USE nag_library, ONLY : nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 CONTAINS SUBROUTINE zprint(k,n,m,ldpar,parlag,x,pvalue,nout) ! .. Use Statements .. USE nag_library, ONLY : x04cbf ! .. Implicit None Statement .. IMPLICIT NONE ! .. Scalar Arguments .. INTEGER, INTENT (IN) :: k, ldpar, m, n, nout ! .. Array Arguments .. REAL (KIND=nag_wp), INTENT (IN) :: parlag(ldpar,ldpar,m), & pvalue(m), x(m) ! .. Local Scalars .. REAL (KIND=nag_wp) :: c1, c2, c3, c5, c6, c7, & inv_sqrt_n, sum INTEGER :: i, i2, ifail, j, l, ll ! .. Local Arrays .. CHARACTER (1) :: clabs(1), rlabs(1) CHARACTER (80) :: rec(7) ! .. Intrinsic Functions .. INTRINSIC real, sqrt ! .. Executable Statements .. ! Print the partial lag correlation matrices. inv_sqrt_n = 1.0E0_nag_wp/sqrt(real(n,kind=nag_wp)) WRITE (nout,*) WRITE (nout,*) ' PARTIAL LAG CORRELATION MATRICES' WRITE (nout,*) ' --------------------------------' DO l = 1, m WRITE (nout,99999) ' Lag = ', l FLUSH (nout) ifail = 0 CALL x04cbf('G','N',k,k,parlag(1,1,l),ldpar,'F9.3',' ','N',rlabs, & 'N',clabs,80,5,ifail) END DO WRITE (nout,99998) ' Standard error = 1 / SQRT(N) =', inv_sqrt_n ! Print indicator symbols to indicate significant elements. WRITE (nout,*) WRITE (nout,*) ' TABLES OF INDICATOR SYMBOLS' WRITE (nout,*) ' ---------------------------' WRITE (nout,99999) ' For Lags 1 to ', m ! Set up annotation for the plots. WRITE (rec(1),99997) ' 0.005 :' WRITE (rec(2),99997) ' + 0.01 :' WRITE (rec(3),99997) ' 0.05 :' WRITE (rec(4)(1:23),99997) ' Sig. Level :' WRITE (rec(4)(24:),99997) '- - - - - - - - - - Lags' WRITE (rec(5),99997) ' 0.05 :' WRITE (rec(6),99997) ' - 0.01 :' WRITE (rec(7),99997) ' 0.005 :' ! Set up the critical values c1 = 3.29E0_nag_wp*inv_sqrt_n c2 = 2.58E0_nag_wp*inv_sqrt_n c3 = 1.96E0_nag_wp*inv_sqrt_n c5 = -c3 c6 = -c2 c7 = -c1 DO i = 1, k DO j = 1, k WRITE (nout,*) IF (i==j) THEN WRITE (nout,99996) ' Auto-correlation function for', & ' series ', i ELSE WRITE (nout,99995) ' Cross-correlation function for', & ' series ', i, ' and series', j END IF DO l = 1, m ll = 23 + 2*l sum = parlag(i,j,l) ! Clear the last plot with blanks DO i2 = 1, 7 IF (i2/=4) THEN rec(i2) (ll:ll) = ' ' END IF END DO ! Check for significance IF (sum>c1) THEN rec(1) (ll:ll) = '*' END IF IF (sum>c2) THEN rec(2) (ll:ll) = '*' END IF IF (sum>c3) THEN rec(3) (ll:ll) = '*' END IF IF (sum