From Kurt.Hornik@ci.tuwien.ac.at  Fri Apr  9 11:48:46 1999
From: Kurt.Hornik@ci.tuwien.ac.at (Kurt Hornik)
Date: Fri, 9 Apr 1999 12:48:46 +0200 (CEST)
Subject: Error in ppois function (PR#161)
In-Reply-To: <199904090748.JAA00884@blueberry.kubism.ku.dk>
References: <199904090748.JAA00884@blueberry.kubism.ku.dk>
Message-ID: <14093.56078.682524.466080@pc87.maho.magnaeu.com>

>>>>> ripley  writes:

> On Fri, 9 Apr 1999 ihaka@stat.auckland.ac.nz wrote:
>> On Fri, 9 Apr 1999, Prof Brian D Ripley wrote:
>> 
>> >      ppois(q, lambda)
>> > 
>> > where q is undefined! It should only be defined for integers. Similarly, x
>> > should only be integers.
>> 
>> Ummmm.  I guess I see the argument for dpois, but I thought the
>> distribution function was defined for all values.  Wouldn't it be in order
>> to apply the integer argument function to floor(q) perhaps?

> Try reading on:

>> > It seems better to make ppois defined as the CDF for all q. The code
> had
>> > 
>> >    x = floor(x + 0.5);
>> >
>> > and that should be something like floor(x + 1e-7).

> (q in R is x in C.)

>> This seems to be what S does.
>> 
>> > ppois(1.5, 2)
>> [1] 0.4060058
>> > ppois(1.1, 2)
>> [1] 0.4060058

> and R-0.64.1 does

>> ppois(1.5, 2)
> [1] 0.4060058
>> ppois(1.1, 2)
> [1] 0.4060058
>> dpois(1.1, 2)
> Warning: non-integer x = 1.100000
> [1] 0

> Happy?

No!  Why the warning?  dpois(non-integer, something) makes perfect
sense, and simply gives 0.

(Yes, dwilcox() and dsignrank() will need fixing, too ...)

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


Error in ppois function (PR#161)
Kurt Hornik