16972
2016-06-28 11:55:14 +0000
qpois still an error for degenerate distribution
2016-07-14 15:31:05 +0000
1
1
1
Unclassified
R
Accuracy
R 3.3.*
Other
Linux
CLOSED
FIXED
P5
minor
---
1
t.yee
R-core
maechler
robbyjo
oldest_to_newest
92348
0
t.yee
2016-06-28 11:55:14 +0000
This is a continuation of bug 14135.
qpois(-1, 0) and qpois(2, 0) should both return NaN.
That is, when p is invalid. Currently they both
return 0 values.
Thanks!
92539
1
robbyjo
2016-07-13 21:12:29 +0000
This would seem to be fixable by moving the line:
if(lambda == 0) return 0;
to just above mu = lambda; line.
92540
2
maechler
2016-07-14 07:34:51 +0000
Thank you both.
There is one problem with the proposed resolution:
What should qpois(p = 1, lambda = 0)
give?
It currently gives '0' {and that is even tested for in the regression tests},
but would give 'Inf' with the proposed change..
Of course this case, is really a border case. Our usual reasoning is that
limits should always work, but in this case, qpois(1, 0) may look "ill defined", as
lim{p -> 1} qpois(p, 0) = 0
lim{lambda -> 0} qpois(p=1, lambda) = Inf
but I think back compatibility should count more here, and more importantly,
for dpois() and ppois() the limit behavior for lambda --> 0 is pretty well defined (also mentioned on the French version of the Wikipedia page), and then, as ppois(0, 0) = 1,
for the inverse function qpois(), we really want
qpois(p = 1, lambda = 0) |--> 0
92541
3
maechler
2016-07-14 09:36:44 +0000
Similar reasoning applies to other distributions with a limiting case of a point mass. I think their q<dist>() functions do not deal with this issue consistently... but don't have time now to check [[don't find it too important, too]].
I am dealing with
qgeom(*, prob=1)
now, and leave other cases (if they exist) for future reports / or (better) comments to this report.