Skip to content

calculating goodness-of-fit statistics

1 message · Brian Ripley

#
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!