Program g02cdfe
! G02CDF Example Program Text
! Mark 27.3 Release. NAG Copyright 2021.
! .. 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