PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_univar_ci_poisson (g07ab)
Purpose
nag_univar_ci_poisson (g07ab) computes a confidence interval for the mean argument of the Poisson distribution.
Syntax
Description
Given a random sample of size
, denoted by
, from a Poisson distribution with probability function
the point estimate,
, for
is the sample mean,
.
Given and this function computes a confidence interval for the argument , denoted by [], where is in the interval .
The lower and upper confidence limits are estimated by the solutions to the equations
where
.
The relationship between the Poisson distribution and the
-distribution (see page 112 of
Hastings and Peacock (1975)) is used to derive the 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 argument
and scale argument
. These deviates are computed using
nag_stat_inv_cdf_gamma (g01ff).
References
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
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int scalar
-
, the sample size.
Constraint:
.
- 2:
– double scalar
-
The sample mean, .
Constraint:
.
- 3:
– double scalar
-
The confidence level, , for two-sided interval estimate. For example gives a confidence interval.
Constraint:
.
Optional Input Parameters
None.
Output Parameters
- 1:
– double scalar
-
The lower limit, , of the confidence interval.
- 2:
– double scalar
-
The upper limit, , of the confidence interval.
- 3:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
On entry, | , |
or | , |
or | , |
or | . |
-
-
When using the relationship with the gamma distribution to calculate one of the confidence limits, the series to calculate the gamma probabilities has failed to converge. Both
tl and
tu are set to zero. This is a very unlikely error exit and if it occurs please contact
NAG.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
For most cases the results should have a relative accuracy of
where
is the
machine precision (see
nag_machine_precision (x02aj)). Thus on machines with sufficiently high precision the results should be accurate to
significant digits. 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 intervals used.
Further Comments
None.
Example
The following example reads in data showing the number of noxious weed seeds and the frequency with which that number occurred in
subsamples of meadow grass. The data is taken from page 224 of
Snedecor and Cochran (1967). The sample mean is computed as the point estimate of the Poisson argument
.
nag_univar_ci_poisson (g07ab) is then called to compute both a 95% and a 99% confidence interval for the argument
.
Open in the MATLAB editor:
g07ab_example
function g07ab_example
fprintf('g07ab example results\n\n');
num = [0:10];
ifreq = [3 17 26 16 18 9 3 5 0 1 0];
xmean = dot(num,ifreq)/sum(ifreq);
n = int64(sum(ifreq));
fprintf('The point estimate of the Poisson parameter = %10.4f\n', xmean);
ci = [0.95, 0.99];
for j = 1:numel(ci)
clevel = ci(j);
[tl, tu, ifail] = g07ab( ...
n, xmean, clevel);
fprintf('\n%2d percent Confidence Interval for the estimate\n',100*clevel);
fprintf(' (%7.4f, %7.4f)\n', tl, tu);
end
g07ab example results
The point estimate of the Poisson parameter = 3.0204
95 percent Confidence Interval for the estimate
( 2.6861, 3.3848)
99 percent Confidence Interval for the estimate
( 2.5874, 3.5027)
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015