Message-ID: <40069BCA.60109@uni-bayreuth.de>
Date: 2004-01-15T13:55:22Z
From: Matthias Kohl
Subject: Exactness of ppois
Hello,
by checking the precision of a convolution algorithm, we found the
following "inexactness":
We work with R Version 1.8.1 (2003-11-21) on Windows systems (NT, 2000,
XP).
Try the code:
## Kolmogorov distance between two methods to
## determine P(Poisson(lambda)<=x)
Kolm.dist <- function(lam, eps){
x <- seq(0,qpois(1-eps, lambda=lam), by=1)
max(abs(ppois(x, lambda=lam)-cumsum(dpois(x, lambda=lam))))
}
erg<-optimize(Kolm.dist, lower=900, upper=1000, maximum=TRUE, eps=1e-15)
erg
Kolm1.dist <- function(lam, eps){
x <- seq(0,qpois(1-eps, lambda=lam), by=1)
which.max(abs(ppois(x, lambda=lam)-cumsum(dpois(x, lambda=lam))))
}
Kolm1.dist(lam=erg$max, eps=1e-15)
So for lambda=977.8 and x=1001 we get a distance of about 5.2e-06.
(This inexactness seems to hold for all lambda values greater than about
900.)
BUT, summing about 1000 terms of exactness around 1e-16,
we would expect an error of order 1e-13.
We suspect algorithm AS 239 to cause that flaw.
Do you think this could cause other problems apart from
that admittedly extreme example?
Thanks for your attention!
Matthias