PROGRAM g04bbfe ! G04BBF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : g04bbf, nag_wp, x04caf ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: ldtabl = 4, nin = 5, nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: gmean, tol INTEGER :: iblock, ifail, irdf, ldc, lit, n, nt ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: bmean(:), c(:,:), ef(:), r(:), & tmean(:), wk(:), y(:) REAL (KIND=nag_wp) :: tabl(ldtabl,5) INTEGER, ALLOCATABLE :: irep(:), it(:) ! .. Intrinsic Functions .. INTRINSIC abs ! .. Executable Statements .. WRITE (nout,*) 'G04BBF Example Program Results' WRITE (nout,*) ! Skip heading in data file READ (nin,*) ! Read in the problem size READ (nin,*) n, nt, iblock ldc = nt IF (nt>1) THEN lit = n ELSE lit = 1 END IF ALLOCATE (y(n),bmean(abs(iblock)),tmean(nt),irep(nt),c(ldc,nt),r(n), & ef(nt),wk(3*nt),it(lit)) ! Read in the data and plot information READ (nin,*) y(1:n) IF (nt>1) THEN READ (nin,*) it(1:n) END IF ! Use default tolerance tol = 0.0E0_nag_wp ! Use standard degrees of freedom irdf = 0 ! Calculate the ANOVA table ifail = 0 CALL g04bbf(n,y,iblock,nt,it,gmean,bmean,tmean,tabl,ldtabl,c,ldc,irep, & r,ef,tol,irdf,wk,ifail) ! Display results WRITE (nout,*) ' ANOVA table' WRITE (nout,*) WRITE (nout,*) ' Source df SS MS F', & ' Prob' WRITE (nout,*) WRITE (nout,99998) ' Blocks ', tabl(1,1:5) WRITE (nout,99998) ' Treatments ', tabl(2,1:5) WRITE (nout,99998) ' Residual ', tabl(3,1:3) WRITE (nout,99998) ' Total ', tabl(4,1:2) WRITE (nout,*) WRITE (nout,*) ' Efficiency Factors' WRITE (nout,*) WRITE (nout,99999) ef(1:nt) WRITE (nout,*) WRITE (nout,99997) ' Grand Mean', gmean WRITE (nout,*) WRITE (nout,*) ' Treatment Means' WRITE (nout,*) WRITE (nout,99999) tmean(1:nt) WRITE (nout,*) FLUSH (nout) ifail = 0 CALL x04caf('Lower','B',nt,nt,c,ldc, & 'Standard errors of differences between means',ifail) 99999 FORMAT (8F10.2) 99998 FORMAT (A,3X,F3.0,2X,3(F10.2,2X),F9.4) 99997 FORMAT (A,F10.2) END PROGRAM g04bbfe