BINES
Estimates the parameter p of the binomial distribution.
Required Arguments
N — Total number of Bernoulli trials. (Input)
N is the parameter N in the binomial distribution from which one observation (K) has been drawn.
K — Number of successes in the N trials. (Input)
CONPER — Confidence level for two-sided interval estimate, in percent. (Input)
An approximate CONPER percent confidence interval is computed, hence, CONPER must be between 0.0 and 100.0. CONPER often will be 90.0, 95.0, or 99.0. For a one-sided confidence interval with confidence level ONECL, set
CONPER = 100.0  2.0 * (100.0  ONECL).
PHAT — Estimate of p. (Output)
PLOWER — Lower confidence limit for p. (Output)
PUPPER — Upper confidence limit for p. (Output)
FORTRAN 90 Interface
Generic: CALL BINES (N, K, CONPER, PHAT, PLOWER, PUPPER)
Specific: The specific interface names are S_BINES and D_BINES.
FORTRAN 77 Interface
Single: CALL BINES (N, K, CONPER, PHAT, PLOWER, PUPPER)
Double: The double precision name is DBINES.
Description
The routine BINES computes a point estimate and a confidence interval for the parameter, p, of a binomial distribution, using the number of “successes”, K, in a sample of size N from a binomial distribution with probability function
The point estimate for p is merely K/N.
The routine BINES makes use of the relationship between the binomial distribution and the beta distribution (see Johnson and Kotz 1969, Chapter 3) by solving the following equations equivalent to those in Comment 2:
where βa, b,τ is the beta critical value with parameters a and b (that is, the inverse beta distribution function evaluated at 1  ). The routine BETIN see (Chapter 17, “Probability Distribution Function and Inverses”) is used to evaluate the critical values.
Comments
1. Informational errors
Type
Code
Description
3
1
CONPER is 100.0 or too large for accurate computations. The confidence limits are set to 0.0 and 1.0.
3
2
CONPER is 0.0 or too small for accurate computations. The confidence limits are both set to PHAT.
2. Since the binomial is a discrete distribution, it is not possible to construct an exact CONPER% confidence interval for all values of CONPER. Let α = 1  CONPER/100. Then, the approximate lower and upper confidence limits pL and pU (PLOWER and PUPPER) are solutions to the equations
These approximations are not just computational devices. Approximations to the confidence limits are necessary because the binomial distribution is discrete.
Example
In this example, we assume that the number of defective microchips in a given lot follows a binomial distribution. We estimate the proportion defective by taking a sample of 50. In this sample, 3 microchips were found to be defective. The routine BINES is used to estimate p and to compute a 95% confidence interval.
 
USE BINES_INT
USE UMACH_INT
 
IMPLICIT NONE
INTEGER K, N, NOUT
REAL CONPER, PHAT, PLOWER, PUPPER
!
CALL UMACH (2, NOUT)
N = 50
K = 3
CONPER = 95.0
CALL BINES (N, K, CONPER, PHAT, PLOWER, PUPPER)
WRITE (NOUT,99999) PHAT, PLOWER, PUPPER
99999 FORMAT (' Point estimate of the proportion: ', F5.3, /, &
' 95% confidence interval: (', F5.3, ',', F5.3, &
')')
END
Output
 
Point estimate of the proportion: .060
95% confidence interval: ( .013, .165)
Published date: 03/19/2020
Last modified date: 03/19/2020