PROGRAM g02brfe ! G02BRF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : g02brf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. INTEGER :: i, ifail, itype, ldrr, ldx, m, n, & ncases ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: rr(:,:), work1(:), work2(:), x(:,:), & xmiss(:) INTEGER, ALLOCATABLE :: incase(:), kworka(:), kworkb(:), & kworkc(:), miss(:) ! .. Executable Statements .. WRITE (nout,*) 'G02BRF Example Program Results' WRITE (nout,*) ! Skip heading in data file READ (nin,*) ! Read in the problem size READ (nin,*) n, m, itype ldrr = m ldx = n ALLOCATE (rr(ldrr,m),work1(n),work2(n),x(ldx,m),xmiss(m),incase(n), & kworka(n),kworkb(n),kworkc(n),miss(m)) ! Read in data READ (nin,*) (x(i,1:m),i=1,n) ! Read in missing value flags READ (nin,*) miss(1:m) READ (nin,*) xmiss(1:m) ! Display data WRITE (nout,99999) 'Number of variables (columns) =', m WRITE (nout,99999) 'Number of cases (rows) =', n WRITE (nout,*) WRITE (nout,*) 'Data matrix is:-' WRITE (nout,*) WRITE (nout,99998) (i,i=1,m) WRITE (nout,99997) (i,x(i,1:m),i=1,n) WRITE (nout,*) ! Calculate correlation coefficients ifail = 0 CALL g02brf(n,m,x,ldx,miss,xmiss,itype,rr,ldrr,ncases,incase,kworka, & kworkb,kworkc,work1,work2,ifail) ! Display results WRITE (nout,*) 'Matrix of rank correlation coefficients:' WRITE (nout,*) 'Upper triangle -- Spearman''s' WRITE (nout,*) 'Lower triangle -- Kendall''s tau' WRITE (nout,*) WRITE (nout,99998) (i,i=1,m) WRITE (nout,99997) (i,rr(i,1:m),i=1,m) WRITE (nout,*) WRITE (nout,99999) 'Number of cases actually used:', ncases 99999 FORMAT (1X,A,I5) 99998 FORMAT (1X,3I12) 99997 FORMAT (1X,I3,3F12.4) END PROGRAM g02brfe