PROGRAM g07abfe ! G07ABF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : g07abf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: clevel, sum, tl, tu, xmean INTEGER :: ifail, ifreq, n, num ! .. Intrinsic Functions .. INTRINSIC real ! .. Executable Statements .. WRITE (nout,*) 'G07ABF Example Program Results' WRITE (nout,*) ! Skip heading in data file READ (nin,*) ! Read in counts and frequencies sum = 0.0E0_nag_wp n = 0 D_LP: DO READ (nin,*,IOSTAT=ifail) num, ifreq IF (ifail/=0) THEN EXIT D_LP END IF ! Calculate sum sum = sum + real(num,kind=nag_wp)*real(ifreq,kind=nag_wp) n = n + ifreq END DO D_LP ! Estimate poission parameter xmean = sum/real(n,kind=nag_wp) WRITE (nout,99999) 'The point estimate of the Poisson parameter =', & xmean WRITE (nout,*) ! Calculate 95% confidence interval clevel = 0.95E0_nag_wp ifail = 0 CALL g07abf(n,xmean,clevel,tl,tu,ifail) ! Display CI WRITE (nout,*) '95 percent Confidence Interval for the estimate' WRITE (nout,99998) '(', tl, ' ,', tu, ' )' WRITE (nout,*) ! Calculate 99% confidence intervale clevel = 0.99E0_nag_wp ifail = 0 CALL g07abf(n,xmean,clevel,tl,tu,ifail) ! Display CI WRITE (nout,*) '99 percent Confidence Interval for the estimate' WRITE (nout,99998) '(', tl, ' ,', tu, ' )' 99999 FORMAT (1X,A,F7.4) 99998 FORMAT (6X,A,F7.4,A,F7.4,A) END PROGRAM g07abfe