subroutine BINOMLO (m, N, alpha, p_lo, ierr) c Author: Glen Cowan c Date: 6-Jan-1998 c Computes the lower limit at a confidence level cl=1-alpha for the c binomial parameter p, given m successes observed in N trials. c Must be linked with FFINV, ALNGAM, XINBTA, BETAIN. implicit NONE c arguments integer ierr ! 0 = ok integer m integer N real alpha real p_lo c local variables integer n1, n2 real FFINV ! quantile of F distribution real q c begin ierr = 0 if ( m .lt. 0 ) then ierr = 1 elseif ( m .gt. N ) then ierr = 2 elseif ( alpha .lt. 0. ) then ierr = 3 elseif ( alpha .gt. 1. ) then ierr = 4 endif if ( ierr .ne. 0 ) then p_lo = -1. return ! ---------------------> exit endif if ( m .gt. 0 ) then n1 = 2*m n2 = 2*(N-m+1) q = FFINV (alpha, n1, n2, ierr) p_lo = FLOAT(m)*q / (FLOAT(N-m+1) + FLOAT(m)*q) elseif ( m .eq. 0 ) then p_lo = 0. endif return END