Skip to content
Prev 85497 / 398506 Next

calculating goodness-of-fit statistics

On Tue, 31 Jan 2006, Pontarelli, Brett wrote:

            
Hmm: log(0) = -Inf.

Taka Matzmoto said
Yes!  0 * Inf = NaN, 0 * -Inf = NaN, and 0 * NaN = NaN.

Conventionally 0 log0 = 0, since this is the limit of x log x as x -> 0.
That is also what is appropriate in the G^2 formula since it refers to a 
Poisson(0).
values you know will be NaN:
A trick from way back by Bill Venables is to use pmax(observed, 1) inside 
the log.
You have these labelled backwards!

  
    
Message-ID: <Pine.LNX.4.61.0602010806380.24763@gannet.stats>
In-Reply-To: <2047FEBD93E8744D8A82C2510BB823C4E8D8B6@exchg-sea3-02.ant.amazon.com>