Given the number of trials,
, and the number of successes,
, this function computes a
confidence interval for
, the probability parameter of a binomial distribution with probability function,
where
is in the interval
.
The lower and upper confidence limits
and
are estimated by the solutions to the equations;
Three different methods are used depending on the number of trials,
, and the number of successes,
.
-
1.If .
The relationship between the beta and binomial distributions (see page 38 of
Hastings and Peacock (1975)) is used to derive the equivalent equations,
where
is the deviate associated with the lower tail probability,
, of the beta distribution with parameters
and
. These beta deviates are computed using
g01fec.
-
2.If and .
The binomial variate with parameters
and
is approximated by a Poisson variate with mean
, see page 38 of
Hastings and Peacock (1975).
The relationship between the Poisson and
-distributions (see page 112 of
Hastings and Peacock (1975)) is used to derive the following equations;
where
is the deviate associated with the lower tail probability,
, of the
-distribution with
degrees of freedom.
In turn the relationship between the
-distribution and the gamma distribution (see page 70 of
Hastings and Peacock (1975)) yields the following equivalent equations;
where
is the deviate associated with the lower tail probability,
, of the gamma distribution with shape parameter
and scale parameter
. These deviates are computed using
g01ffc.
-
3.If and .
The binomial variate with parameters
and
is approximated by a Normal variate with mean
and variance
, see page 38 of
Hastings and Peacock (1975).
The approximate lower and upper confidence limits
and
are the solutions to the equations;
where
is the deviate associated with the lower tail probability,
, of the standard Normal distribution. These equations are solved using a quadratic equation solver
.
For most cases using the beta deviates the results should have a relative accuracy of
where
is the
machine precision (see
X02AJC). Thus on machines with sufficiently high precision the results should be accurate to
significant figures. Some accuracy may be lost when
or
is very close to
, which will occur if
clevel is very close to
. This should not affect the usual confidence levels used.
Background information to multithreading can be found in the
Multithreading documentation.
None.
The following example program reads in the number of deaths recorded among male recipients of war pensions in a six year period following an initial questionnaire in 1956. We consider two classes, non-smokers and those who reported that they smoked pipes only. The total number of males in each class is also read in. The data is taken from page 216 of
Snedecor and Cochran (1967). An estimate of the probability of a death in the six year period in each class is computed together with 95% confidence intervals for these estimates.