! G13DMF Example Program Text ! Mark 24 Release. NAG Copyright 2012. Module g13dmfe_mod ! G13DMF 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 cprint(k,n,ldr,m,wmean,r0,r,nout) ! .. Use Statements .. Use nag_library, Only: x04cbf ! .. Scalar Arguments .. Integer, Intent (In) :: k, ldr, m, n, nout ! .. Array Arguments .. Real (Kind=nag_wp), Intent (In) :: r(ldr,ldr,m), r0(ldr,k), & wmean(k) ! .. 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 Procedures .. Intrinsic :: real, sqrt ! .. Executable Statements .. ! Print the correlation matrices and indicator symbols. inv_sqrt_n = 1.0E0_nag_wp/sqrt(real(n,kind=nag_wp)) Write (nout,*) Write (nout,*) ' THE MEANS' Write (nout,*) ' ---------' Write (nout,99999) wmean(1:k) Write (nout,*) Write (nout,*) ' CROSS-CORRELATION MATRICES' Write (nout,*) ' --------------------------' Write (nout,99998) ' Lag = ', 0 Flush (nout) ifail = 0 Call x04cbf('G','N',k,k,r0,ldr,'F9.3',' ','N',rlabs,'N',clabs,80,5, & ifail) Do l = 1, m Write (nout,99998) ' Lag = ', l Flush (nout) ifail = 0 Call x04cbf('G','N',k,k,r(1,1,l),ldr,'F9.3',' ','N',rlabs,'N',clabs, & 80,5,ifail) End Do ! Print indicator symbols to indicate significant elements. Write (nout,99997) ' Standard error = 1 / SQRT(N) =', inv_sqrt_n Write (nout,*) Write (nout,*) ' TABLES OF INDICATOR SYMBOLS' Write (nout,*) ' ---------------------------' Write (nout,99998) ' For Lags 1 to ', m ! Set up annotation for the plots. Write (rec(1),99996) ' 0.005 :' Write (rec(2),99996) ' + 0.01 :' Write (rec(3),99996) ' 0.05 :' Write (rec(4)(1:23),99996) ' Sig. Level :' Write (rec(4)(24:),99996) '- - - - - - - - - - Lags' Write (rec(5),99996) ' 0.05 :' Write (rec(6),99996) ' - 0.01 :' Write (rec(7),99996) ' 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,99995) ' Auto-correlation function for', ' series ', & i Else Write (nout,99994) ' Cross-correlation function for', & ' series ', i, ' and series', j End If Do l = 1, m ll = 23 + 2*l sum = r(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