hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_univar_ci_poisson (g07ab)

Purpose

nag_univar_ci_poisson (g07ab) computes a confidence interval for the mean parameter of the Poisson distribution.

Syntax

[tl, tu, ifail] = g07ab(n, xmean, clevel)
[tl, tu, ifail] = nag_univar_ci_poisson(n, xmean, clevel)

Description

Given a random sample of size nn, denoted by x1,x2,,xnx1,x2,,xn, from a Poisson distribution with probability function
p(x) = eθ(θx)/(x ! ),  x = 0,1,2,
p(x)=e-θ θxx! ,  x=0,1,2,
the point estimate, θ̂θ^, for θθ is the sample mean, xx-.
Given nn and xx- this function computes a 100(1α)%100(1-α)% confidence interval for the parameter θθ, denoted by [θl,θuθl,θu], where αα is in the interval (0,1)(0,1).
The lower and upper confidence limits are estimated by the solutions to the equations
enθl((nθl)x)/(x ! ) = α/2,
x = T
T
enθu((nθu)x)/(x ! ) = α/2,
x = 0
e-nθlx=T (nθl)xx! =α2, e-nθux=0T(nθu)xx! =α2,
where T = i = 1nxi = nθ̂T=i=1nxi=nθ^.
The relationship between the Poisson distribution and the χ2χ2-distribution (see page 112 of Hastings and Peacock (1975)) is used to derive the equations
θl = 1/(2n)χ2T,α / 22,
θu = 1/(2n)χ2T + 2,1α / 22,
θl= 12n χ2T,α/22, θu= 12n χ2T+2,1-α/22,
where χν,p2χν,p2 is the deviate associated with the lower tail probability pp of the χ2χ2-distribution with νν degrees of freedom.
In turn the relationship between the χ2χ2-distribution and the gamma distribution (see page 70 of Hastings and Peacock (1975)) yields the following equivalent equations;
θl = 1/(2n)γT,2;α / 2,
θu = 1/(2n)γT + 1,2;1α / 2,
θ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 parameter αα and scale parameter ββ. 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:     n – int64int32nag_int scalar
nn, the sample size.
Constraint: n1n1.
2:     xmean – double scalar
The sample mean, xx-.
Constraint: xmean0.0xmean0.0.
3:     clevel – double scalar
The confidence level, (1α)(1-α), for two-sided interval estimate. For example clevel = 0.95clevel=0.95 gives a 95%95% confidence interval.
Constraint: 0.0 < clevel < 1.00.0<clevel<1.0.

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     tl – double scalar
The lower limit, θlθl, of the confidence interval.
2:     tu – double scalar
The upper limit, θuθu, of the confidence interval.
3:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,n < 1n<1,
orxmean < 0.0xmean<0.0,
orclevel0.0clevel0.0,
orclevel1.0clevel1.0.
  ifail = 2ifail=2
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.

Accuracy

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

Further Comments

None.

Example

function nag_univar_ci_poisson_example
n = int64(98);
xmean = 3.020408163265306;
clevel = 0.95;
[tl, tu, ifail] = nag_univar_ci_poisson(n, xmean, clevel)
 

tl =

    2.6861


tu =

    3.3848


ifail =

                    0


function g07ab_example
n = int64(98);
xmean = 3.020408163265306;
clevel = 0.95;
[tl, tu, ifail] = g07ab(n, xmean, clevel)
 

tl =

    2.6861


tu =

    3.3848


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013