NAG Library Routine Document
g07abf
(ci_poisson)
1
Purpose
g07abf computes a confidence interval for the mean argument of the Poisson distribution.
2
Specification
Fortran Interface
Integer, Intent (In) | :: |
n | Integer, Intent (Inout) | :: |
ifail | Real (Kind=nag_wp), Intent (In) | :: |
xmean,
clevel | Real (Kind=nag_wp), Intent (Out) | :: |
tl,
tu |
|
C Header Interface
#include nagmk26.h
void |
g07abf_ (
const Integer *n,
const double *xmean,
const double *clevel,
double *tl,
double *tu,
Integer *ifail) |
|
3
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 routine 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
g01fff.
4
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
5
Arguments
- 1: – IntegerInput
-
On entry: , the sample size.
Constraint:
.
- 2: – Real (Kind=nag_wp)Input
-
On entry: the sample mean, .
Constraint:
.
- 3: – Real (Kind=nag_wp)Input
-
On entry: the confidence level, , for two-sided interval estimate. For example gives a confidence interval.
Constraint:
.
- 4: – Real (Kind=nag_wp)Output
-
On exit: the lower limit, , of the confidence interval.
- 5: – Real (Kind=nag_wp)Output
-
On exit: the upper limit, , of the confidence interval.
- 6: – IntegerInput/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this argument, the recommended value is
.
When the value is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
-
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.
See
Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See
Section 3.7 in How to Use the NAG Library and its Documentation for further information.
7
Accuracy
For most cases the results should have a relative accuracy of
where
is the
machine precision (see
x02ajf). 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.
8
Parallelism and Performance
g07abf is not threaded in any implementation.
None.
10
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
.
g07abf is then called to compute both a 95% and a 99% confidence interval for the argument
.
10.1
Program Text
Program Text (g07abfe.f90)
10.2
Program Data
Program Data (g07abfe.d)
10.3
Program Results
Program Results (g07abfe.r)