PROGRAM g02cdfe ! G02CDF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : g02cdf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: xmiss, ymiss INTEGER :: i, ifail, n ! .. Local Arrays .. REAL (KIND=nag_wp) :: reslt(21) REAL (KIND=nag_wp), ALLOCATABLE :: x(:), y(:) ! .. Executable Statements .. WRITE (nout,*) 'G02CDF 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(i),y(i),i=1,n) ! Read in missing value flags READ (nin,*) xmiss, ymiss ! Display data WRITE (nout,*) ' Case Independent Dependent' WRITE (nout,*) 'number variable variable' WRITE (nout,*) WRITE (nout,99999) (i,x(i),y(i),i=1,n) WRITE (nout,*) ! Fit linear regression model ifail = 0 CALL g02cdf(n,x,y,xmiss,ymiss,reslt,ifail) ! Display results WRITE (nout,99998) 'Mean of independent variable = ', & reslt(1) WRITE (nout,99998) 'Mean of dependent variable = ', & reslt(2) WRITE (nout,99998) 'Standard deviation of independent variable = ', & reslt(3) WRITE (nout,99998) 'Standard deviation of dependent variable = ', & reslt(4) WRITE (nout,99998) 'Correlation coefficient = ', & reslt(5) WRITE (nout,*) WRITE (nout,99998) 'Regression coefficient = ', & reslt(6) WRITE (nout,99998) 'Standard error of coefficient = ', & reslt(8) WRITE (nout,99998) 't-value for coefficient = ', & reslt(10) WRITE (nout,*) WRITE (nout,*) 'Analysis of regression table :-' WRITE (nout,*) WRITE (nout,*) ' Source Sum of squares D.F. & & Mean square F-value' WRITE (nout,*) WRITE (nout,99997) 'Due to regression', reslt(12:15) WRITE (nout,99997) 'About regression', reslt(16:18) WRITE (nout,99997) 'Total ', reslt(19:20) WRITE (nout,*) WRITE (nout,99996) 'Number of cases used = ', reslt(21) 99999 FORMAT (1X,I4,2F15.4) 99998 FORMAT (1X,A,F8.4) 99997 FORMAT (1X,A,F14.4,F8.0,2F14.4) 99996 FORMAT (1X,A,F3.0) END PROGRAM g02cdfe