predIntPois {EnvStats} | R Documentation |
Prediction Interval for a Poisson Distribution
Description
Estimate the mean of a Poisson distribution
, and
construct a prediction interval for the next observations or
next set of
sums.
Usage
predIntPois(x, k = 1, n.sum = 1, method = "conditional",
pi.type = "two-sided", conf.level = 0.95, round.limits = TRUE)
Arguments
x |
numeric vector of observations, or an object resulting from a call to an
estimating function that assumes a Poisson distribution
(i.e., |
k |
positive integer specifying the number of future observations or sums the
prediction interval should contain with confidence level |
n.sum |
positive integer specifying the sample size associated with the |
method |
character string specifying the method to use. The possible values are: See the DETAILS section for more information on these methods. The |
pi.type |
character string indicating what kind of prediction interval to compute.
The possible values are |
conf.level |
a scalar between 0 and 1 indicating the confidence level of the prediction interval.
The default value is |
round.limits |
logical scalar indicating whether to round the computed prediction limits to the
nearest integer. The default value is |
Details
A prediction interval for some population is an interval on the real line constructed so
that it will contain future observations or averages from that population with
some specified probability
, where 0 <
< 1 and
is some pre-specified positive integer. The quantity
is call
the confidence coefficient or confidence level associated with the prediction interval.
In the case of a Poisson distribution, we have modified the
usual meaning of a prediction interval and instead construct an interval that will
contain future observations or
future sums with a certain
confidence level.
A prediction interval is a random interval; that is, the lower and/or
upper bounds are random variables computed based on sample statistics in the
baseline sample. Prior to taking one specific baseline sample, the probability
that the prediction interval will contain the next averages is
. Once a specific baseline sample is taken and the
prediction interval based on that sample is computed, the probability that that
prediction interval will contain the next
averages is not necessarily
, but it should be close.
If an experiment is repeated times, and for each experiment:
A sample is taken and a
prediction interval for
future observation is computed, and
One future observation is generated and compared to the prediction interval,
then the number of prediction intervals that actually contain the future observation
generated in step 2 above is a binomial random variable with parameters
size=
and
prob=
(see Binomial).
If, on the other hand, only one baseline sample is taken and only one prediction
interval for future observation is computed, then the number of
future observations out of a total of
future observations that will be
contained in that one prediction interval is a binomial random variable with
parameters
size=
and
prob=
, where
depends on the true population parameters and the computed
bounds of the prediction interval.
Because of the discrete nature of the Poisson distribution,
even if the true mean of the distribution were known exactly, the
actual confidence level associated with a prediction limit will usually not be exactly equal to
. For example, for the Poisson distribution with parameter
lambda=2
, the interval [0, 4] contains 94.7% of this distribution and
the interval [0,5] contains 98.3% of this distribution. Thus, no interval can
contain exactly 95% of this distribution, so it is impossible to construct an
exact 95% prediction interval for the next observation for a
Poisson distribution with parameter
lambda=2
.
The Form of a Poisson Prediction Interval
Let denote a vector of
observations from a Poisson distribution with parameter
lambda=
. Also, let
denote the sum of these
random variables, i.e.,
Finally, let denote the sample size associated with the
future
sums (i.e.,
n.sum=
). When
, each sum is really just a
single observation, so in the rest of this help file the term “sums”
replaces the phrase “observations or sums”.
Let denote a vector of
future observations from a Poisson distribution with parameter
lambda=
, and set
equal to the sum of these
random variables, i.e.,
Then has a Poisson distribution with parameter
lambda=
(Johnson et al., 1992, p.160). We are interested
in constructing a prediction limit for the next value of
, or else the next
sums of
Poisson random variables, based on the observed value of
and assuming
.
For a Poisson distribution, the form of a two-sided prediction interval is:
where
and is a constant that depends on the sample size
, the
confidence level
, the number of future sums
,
and the sample size associated with the future sums
. Do not confuse
the constant
(uppercase
) with the number of future sums
(lowercase
). The symbol
is used here to be consistent
with the notation used for prediction intervals for the normal distribution
(see
predIntNorm
).
Similarly, the form of a one-sided lower prediction interval is:
and the form of a one-sided upper prediction interval is:
The derivation of the constant is explained below.
Conditional Distribution (method="conditional"
)
Nelson (1970) derives a prediction interval for the case based on the
conditional distribution of
given
. He notes that the conditional
distribution of
given the quantity
is
binomial with parameters
size=
and
prob=
(Johnson et al., 1992, p.161). When
, the prediction limits are computed
as those most extreme values of
that still yield a non-significant test of
the hypothesis
, which for the conditional
distribution of
is equivalent to the hypothesis
:
prob=[m /(m + n)]
.
Using the relationship between the binomial and
F-distribution (see the explanation of exact confidence
intervals in the help file for ebinom
), Nelson (1982, p. 203) states
that exact two-sided prediction limits [LPL, UPL] are the
closest integer solutions to the following equations:
where denotes the
'th quantile of the
F-distribution with
and
degrees of
freedom.
If ci.type="lower"
, is replaced with
in
Equation (8) above for
, and
is set to
.
If ci.type="upper"
, is replaced with
in
Equation (9) above for
, and
is set to 0.
NOTE: This method is not extended to the case .
Conditional Distribution Approximation Based on Normal Distribution
(method="conditional.approx.normal"
)
Cox and Hinkley (1974, p.245) derive an approximate prediction interval for the case
. Like Nelson (1970), they note that the conditional distribution of
given the quantity
is binomial with
parameters
size=
and
prob=
, and that the
hypothesis
is equivalent to the hypothesis
:
prob=[m /(m + n)]
.
Cox and Hinkley (1974, p.245) suggest using the normal approximation to the
binomial distribution (in this case, without the continuity correction;
see Zar, 2010, pp.534-536 for information on the continuity correction associated
with the normal approximation to the binomial distribution). Under the null
hypothesis , the quantity
is approximately distributed as a standard normal random variable.
The Case When k = 1
When and
pi.type="two-sided"
, the prediction limits are computed
by solving the equation
where denotes the
'th quantile of the standard normal distribution.
In this case, Gibbons (1987b) notes that the quantity
in Equation (3) above
is given by:
where .
When pi.type="lower"
or pi.type="upper"
, is computed exactly
as above, except
is set to
.
The Case When k > 1
When , Gibbons (1987b) suggests using the Bonferroni inequality.
That is, the value of
is computed exactly as for the case
described above, except that the Bonferroni value of
is used in place of the
usual value of
:
When pi.type="two-side"
, .
When pi.type="lower"
or pi.type="upper"
, .
Conditional Distribution Approximation Based on Student's t-Distribution
(method="conditional.approx.t"
)
When method="conditional.approx.t"
, the exact same procedure is used as when
method="conditional.approx.normal"
, except that the quantity in
Equation (10) is assumed to follow a Student's t-distribution with
degrees of freedom. Thus, all occurrences of
are replaced with
, where
denotes the
'th quantile of
Student's t-distribution with
degrees of freedom.
Normal Approximation (method="normal.approx"
)
The normal approximation for Poisson prediction limits was given by
Nelson (1970; 1982, p.203) and is based on the fact that the mean and variance of a
Poisson distribution are the same (Johnson et al, 1992, p.157), and for
“large” values of and
, both
and
are
approximately normally distributed.
The Case When k = 1
The quantity is approximately normally distributed with expectation and
variance given by:
so the quantity
is approximately distributed as a standard normal random variable. The function
predIntPois
, however, assumes this quantity is distributed as approximately
a Student's t-distribution with degrees of freedom.
Thus, following the idea of prediction intervals for a normal distribution
(see predIntNorm
), when pi.type="two-sided"
, the constant
for a
prediction interval for the next
sum
of
observations is computed as:
where denotes the
'th quantile of a
Student's t-distribution with
degrees of freedom.
Similarly, when pi.type="lower"
or pi.type="upper"
, the constant
is computed as:
The Case When k > 1
When , the value of
is computed exactly as for the case
described above, except that the Bonferroni value of
is used
in place of the usual value of
:
When pi.type="two-sided"
,
When pi.type="lower"
or pi.type="upper"
,
Hahn and Nelson (1973, p.182) discuss another method of computing when
, but this method is not implemented here.
Value
If x
is a numeric vector, predIntPois
returns a list of class
"estimate"
containing the estimated parameter, the prediction interval,
and other information. See the help file for
estimate.object
for details.
If x
is the result of calling an estimation function,
predIntPois
returns a list whose class is the same as x
.
The list contains the same components as x
, as well as a component called
interval
containing the prediction interval information.
If x
already has a component called interval
, this component is
replaced with the prediction interval information.
Note
Prediction and tolerance intervals have long been applied to quality control and life testing problems. Nelson (1970) notes that his development of confidence and prediction limits for the Poisson distribution is based on well-known results dating back to the 1950's. Hahn and Nelson (1973) review predicion intervals for several distributions, including Poisson prediction intervals. The mongraph by Hahn and Meeker (1991) includes a discussion of Poisson prediction intervals.
Gibbons (1987b) uses the Poisson distribution to model the number of detected
compounds per scan of the 32 volatile organic priority pollutants (VOC), and also
to model the distribution of chemical concentration (in ppb), and presents formulas
for prediction and tolerance intervals. The formulas for prediction intervals are
based on Cox and Hinkley (1974, p.245). Gibbons (1987b) only deals with
the case where n.sum=1
.
Gibbons et al. (2009, pp. 72–76) discuss methods for Poisson prediction limits.
Author(s)
Steven P. Millard (EnvStats@ProbStatInfo.com)
References
Cox, D.R., and D.V. Hinkley. (1974). Theoretical Statistics. Chapman and Hall, New York, pp.242–245.
Gibbons, R.D. (1987b). Statistical Models for the Analysis of Volatile Organic Compounds in Waste Disposal Sites. Ground Water 25, 572–580.
Gibbons, R.D., D.K. Bhaumik, and S. Aryal. (2009). Statistical Methods for Groundwater Monitoring, Second Edition. John Wiley & Sons, Hoboken, pp. 72–76.
Hahn, G.J., and W.Q. Meeker. (1991). Statistical Intervals: A Guide for Practitioners. John Wiley and Sons, New York.
Hahn, G., and W. Nelson. (1973). A Survey of Prediction Intervals and Their Applications. Journal of Quality Technology 5, 178–188.
Johnson, N. L., S. Kotz, and A. Kemp. (1992). Univariate Discrete Distributions. Second Edition. John Wiley and Sons, New York, Chapter 4.
Millard, S.P., and N.K. Neerchal. (2001). Environmental Statistics with S-PLUS. CRC Press, Boca Raton.
Miller, R.G. (1981a). Simultaneous Statistical Inference. McGraw-Hill, New York, pp.8, 76–81.
Nelson, W.R. (1970). Confidence Intervals for the Ratio of Two Poisson Means and Poisson Predictor Intervals. IEEE Transactions of Reliability R-19, 42–49.
Nelson, W.R. (1982). Applied Life Data Analysis. John Wiley and Sons, New York, pp.200–204.
Zar, J.H. (2010). Biostatistical Analysis. Fifth Edition. Prentice-Hall, Upper Saddle River, NJ, pp. 585–586.
See Also
Poisson
, epois
,
estimate.object
, Prediction Intervals,
tolIntPois
, Estimating Distribution Parameters.
Examples
# Generate 20 observations from a Poisson distribution with parameter
# lambda=2. The interval [0, 4] contains 94.7% of this distribution and
# the interval [0,5] contains 98.3% of this distribution. Thus, because
# of the discrete nature of the Poisson distribution, no interval contains
# exactly 95% of this distribution. Use predIntPois to estimate the mean
# parameter of the true distribution, and construct a one-sided upper
# 95% prediction interval for the next single observation from this distribution.
# (Note: the call to set.seed simply allows you to reproduce this example.)
set.seed(250)
dat <- rpois(20, lambda = 2)
predIntPois(dat, pi.type = "upper")
#Results of Distribution Parameter Estimation
#--------------------------------------------
#
#Assumed Distribution: Poisson
#
#Estimated Parameter(s): lambda = 1.8
#
#Estimation Method: mle/mme/mvue
#
#Data: dat
#
#Sample Size: 20
#
#Prediction Interval Method: conditional
#
#Prediction Interval Type: upper
#
#Confidence Level: 95%
#
#Number of Future Observations: 1
#
#Prediction Interval: LPL = 0
# UPL = 5
#----------
# Compare results above with the other approximation methods:
predIntPois(dat, method = "conditional.approx.normal",
pi.type = "upper")$interval$limits
#LPL UPL
# 0 4
predIntPois(dat, method = "conditional.approx.t",
pi.type = "upper")$interval$limits
#LPL UPL
# 0 4
predIntPois(dat, method = "normal.approx",
pi.type = "upper")$interval$limits
#LPL UPL
# 0 4
#Warning message:
#In predIntPois(dat, method = "normal.approx", pi.type = "upper") :
# Estimated value of 'lambda' and/or number of future observations
# is/are probably too small for the normal approximation to work well.
#==========
# Using the same data as in the previous example, compute a one-sided
# upper 95% prediction limit for k=10 future observations.
# Using conditional approximation method based on the normal distribution.
predIntPois(dat, k = 10, method = "conditional.approx.normal",
pi.type = "upper")
#Results of Distribution Parameter Estimation
#--------------------------------------------
#
#Assumed Distribution: Poisson
#
#Estimated Parameter(s): lambda = 1.8
#
#Estimation Method: mle/mme/mvue
#
#Data: dat
#
#Sample Size: 20
#
#Prediction Interval Method: conditional.approx.normal
#
#Prediction Interval Type: upper
#
#Confidence Level: 95%
#
#Number of Future Observations: 10
#
#Prediction Interval: LPL = 0
# UPL = 6
# Using method based on approximating conditional distribution with
# Student's t-distribution
predIntPois(dat, k = 10, method = "conditional.approx.t",
pi.type = "upper")$interval$limits
#LPL UPL
# 0 6
#==========
# Repeat the above example, but set k=5 and n.sum=3. Thus, we want a
# 95% upper prediction limit for the next 5 sets of sums of 3 observations.
predIntPois(dat, k = 5, n.sum = 3, method = "conditional.approx.t",
pi.type = "upper")$interval$limits
#LPL UPL
# 0 12
#==========
# Reproduce Example 3.6 in Gibbons et al. (2009, p. 75)
# A 32-constituent VOC scan was performed for n=16 upgradient
# samples and there were 5 detections out of these 16. We
# want to construct a one-sided upper 95% prediction limit
# for 20 monitoring wells (so k=20 future observations) based
# on these data.
# First we need to create a data set that will yield a mean
# of 5/16 based on a sample size of 16. Any number of data
# sets will do. Here are two possible ones:
dat <- c(rep(1, 5), rep(0, 11))
dat <- c(2, rep(1, 3), rep(0, 12))
# Now call predIntPois. Don't round the limits so we can
# compare to the example in Gibbons et al. (2009).
predIntPois(dat, k = 20, method = "conditional.approx.t",
pi.type = "upper", round.limits = FALSE)
#Results of Distribution Parameter Estimation
#--------------------------------------------
#
#Assumed Distribution: Poisson
#
#Estimated Parameter(s): lambda = 0.3125
#
#Estimation Method: mle/mme/mvue
#
#Data: dat
#
#Sample Size: 16
#
#Prediction Interval Method: conditional.approx.t
#
#Prediction Interval Type: upper
#
#Confidence Level: 95%
#
#Number of Future Observations: 20
#
#Prediction Interval: LPL = 0.000000
# UPL = 2.573258
#==========
# Cleanup
#--------
rm(dat)