nag_poisson_ci (g07abc) (PDF version)
g07 Chapter Contents
g07 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_poisson_ci (g07abc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_poisson_ci (g07abc) computes a confidence interval for the mean argument of the Poisson distribution.

2  Specification

#include <nag.h>
#include <nagg07.h>
void  nag_poisson_ci (Integer n, double xmean, double clevel, double *tl, double *tu, NagError *fail)

3  Description

Given a random sample of size n, denoted by x1,x2,,xn, from a Poisson distribution with probability function
px=e-θ θxx! ,  x=0,1,2,
the point estimate, θ^, for θ is the sample mean, x-.
Given n and x- this function computes a 1001-α% confidence interval for the argument θ, denoted by [θl,θu], where α is in the interval 0,1.
The lower and upper confidence limits are estimated by the solutions to the equations
e-nθlx=T nθlxx! =α2, e-nθux=0Tnθuxx! =α2,
where T=i=1nxi=nθ^.
The relationship between the Poisson distribution and the χ2-distribution (see page 112 of Hastings and Peacock (1975)) is used to derive the equations
θl= 12n χ2T,α/22, θu= 12n χ2T+2,1-α/22,
where χν,p2 is the deviate associated with the lower tail probability p of the χ2-distribution with ν degrees of freedom.
In turn the relationship between the χ2-distribution and the gamma distribution (see page 70 of Hastings and Peacock (1975)) yields the following equivalent equations;
θl= 12n γT,2;α/2, θu= 12n γT+1,2;1-α/2,
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_deviates_gamma_dist (g01ffc).

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:     nIntegerInput
On entry: n, the sample size.
Constraint: n1.
2:     xmeandoubleInput
On entry: the sample mean, x-.
Constraint: xmean0.0.
3:     cleveldoubleInput
On entry: the confidence level, 1-α, for two-sided interval estimate. For example clevel=0.95 gives a 95% confidence interval.
Constraint: 0.0<clevel<1.0.
4:     tldouble *Output
On exit: the lower limit, θl, of the confidence interval.
5:     tudouble *Output
On exit: the upper limit, θu, of the confidence interval.
6:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_CONVERGENCE
When using the relationship with the gamma distribution the series to calculate the gamma probabilities has failed to converge.
NE_INT
On entry, n=value.
Constraint: n>0.
NE_INTERNAL_ERROR
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.
NE_REAL
On entry, clevel0.0 or clevel1.0: clevel=value.
On entry, xmean=value.
Constraint: xmean0.0.

7  Accuracy

For most cases the results should have a relative accuracy of max0.5e-12,50.0×ε where ε is the machine precision (see nag_machine_precision (X02AJC)). Thus on machines with sufficiently high precision the results should be accurate to 12 significant digits. Some accuracy may be lost when α/2 or 1-α/2 is very close to 0.0, which will occur if clevel is very close to 1.0. This should not affect the usual confidence intervals used.

8  Parallelism and Performance

Not applicable.

9  Further Comments

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 98 sub-samples 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_poisson_ci (g07abc) is then called to compute both a 95% and a 99% confidence interval for the argument θ.

10.1  Program Text

Program Text (g07abce.c)

10.2  Program Data

Program Data (g07abce.d)

10.3  Program Results

Program Results (g07abce.r)


nag_poisson_ci (g07abc) (PDF version)
g07 Chapter Contents
g07 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2014