evaluating 0 * log(0) in log probabilities

9 views
Skip to first unread message

Daniel Lee

unread,
Dec 28, 2011, 12:12:57 AM12/28/11
to stan...@googlegroups.com
In c++ math, this evaluates to NaN. Since this represents log(0^0), I
think this should evaluate to 0.

Is there anything subtle to worry about with this calculation? If
there isn't, I'll start incorporating it into the distributions.


Daniel

Matt Hoffman

unread,
Dec 28, 2011, 11:56:42 AM12/28/11
to stan...@googlegroups.com
0*log(0) comes up all the time (e.g. when assigning 0 probability to
an unobserved event), and we almost always want it to be 0, since for
most distributions we care about it makes no practical difference if
θ=0 or θ=1e-100, and the limit when approaching 0*log(0)=0.

I don't know of any (non-pathological) subtleties to do with this that
could bite us; if any exist, my opinion is that they're unlikely to
cause us more trouble than letting 0*log(0)=NaN.

Matt

Reply all
Reply to author
Forward
0 new messages