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
Hastings N A J and Peacock J B (1975) Statistical Distributions Butterworth
Snedecor G W and Cochran W G (1967) Statistical Methods Iowa State University Press
1: – IntegerInput
On entry: , the number of trials.
2: – IntegerInput
On entry: , the number of successes.
3: – doubleInput
On entry: the confidence level, , for two-sided interval estimate. For example will give a confidence interval.
4: – double *Output
On exit: the lower limit, , of the confidence interval.
5: – double *Output
On exit: the upper limit, , of the confidence interval.
6: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument had an illegal value.
When using the relationship with the gamma distribution the series to calculate the gamma probabilities has failed to converge. Both pl and pu are set to zero. This is an unlikely error exit.
On entry, .
On entry, .
On entry, and .
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
On entry, .
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.
The approximations used when is large are accurate to at least significant digits but usually to more.
8Parallelism and Performance
g07aac is not threaded in any implementation.
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.