Program g08alfe
! G08ALF Example Program Text
! Mark 27.2 Release. NAG Copyright 2021.
! .. Use Statements ..
Use nag_library, Only: g08alf, nag_wp, x04caf
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: df, prob, q
Integer :: i, ifail, k, ldx, n
! .. Local Arrays ..
Real (Kind=nag_wp), Allocatable :: x(:,:)
! .. Intrinsic Procedures ..
Intrinsic :: real
! .. Executable Statements ..
Write (nout,*) 'G08ALF Example Program Results'
Write (nout,*)
! Skip heading in data file
Read (nin,*)
! Read in the problem size
Read (nin,*) n, k
ldx = n
Allocate (x(ldx,k))
! Read in the data
Read (nin,*)(x(i,1:k),i=1,n)
! Display title
Write (nout,*) 'Cochrans Q test'
Write (nout,*)
Flush (nout)
! Display the input data
ifail = 0
Call x04caf('General',' ',n,k,x,ldx,'Data matrix',ifail)
! Perform test
ifail = 0
Call g08alf(n,k,x,ldx,q,prob,ifail)
! Display results
df = real(k-1,kind=nag_wp)
Write (nout,*)
Write (nout,99999) 'Cochrans Q test statistic = ', q
Write (nout,99998) 'Degrees of freedom = ', df
Write (nout,99999) 'Upper-tail probability = ', prob
99999 Format (1X,A,F12.4)
99998 Format (1X,A,F6.1)
End Program g08alfe