Program g08affe ! G08AFF Example Program Text ! Mark 24 Release. NAG Copyright 2012. ! .. Use Statements .. Use nag_library, Only: g08aff, nag_wp ! .. Implicit None Statement .. Implicit None ! .. Parameters .. Integer, Parameter :: nin = 5, nout = 6 ! .. Local Scalars .. Real (Kind=nag_wp) :: h, p Integer :: i, ifail, k, lx, nhi, nlo ! .. Local Arrays .. Real (Kind=nag_wp), Allocatable :: w(:), x(:) Integer, Allocatable :: l(:) ! .. Intrinsic Procedures .. Intrinsic :: sum ! .. Executable Statements .. Write (nout,*) 'G08AFF Example Program Results' Write (nout,*) ! Skip heading in data file Read (nin,*) ! Read in problem size Read (nin,*) k Allocate (l(k)) ! Read in number of observations in each sample Read (nin,*) l(1:k) ! Calculate total number of observations lx = sum(l(1:k)) Allocate (x(lx),w(lx)) ! Read in data Read (nin,*) x(1:lx) ! Display title Write (nout,*) 'Kruskal-Wallis test' Write (nout,*) ! Display input data Write (nout,*) 'Data values' Write (nout,*) Write (nout,*) ' Group Observations' nlo = 1 Do i = 1, k nhi = nlo + l(i) - 1 Write (nout,99999) i, x(nlo:nhi) nlo = nlo + l(i) End Do ! Perform ANOVA ifail = 0 Call g08aff(x,lx,l,k,w,h,p,ifail) ! Display results Write (nout,*) Write (nout,99998) 'Test statistic ', h Write (nout,99997) 'Degrees of freedom ', k - 1 Write (nout,99998) 'Significance ', p 99999 Format (1X,I5,5X,10F4.0) 99998 Format (1X,A,F9.3) 99997 Format (1X,A,I9) End Program g08affe