s-news
[Top] [All Lists]

RE: [S] log(0) problem

To: scott.chasalow@cereon.com
Subject: RE: [S] log(0) problem
From: Alan Zaslavsky <zaslavsk@hcp.med.harvard.edu>
Date: Fri, 17 Dec 1999 17:04:27 -0500 (EST)
Cc: BMCCULLO@fcc.gov, s-news@wubios.wustl.edu
Sender: owner-s-news@wubios.wustl.edu
> Now, it seems to me that if you're going to define 0^0 as 1,
> it would be only consistent and polite to define
> 0log(0) = log(1) = 0.  Or am I missing something here?
> Are there times when you would not want 0log(0) (or for that
> matter, 0*(-Inf)) to be 0?

S-Plus or other programming languages have to deal with ambiguous questions
by giving ambiguous answers.  We can't expect the language to be able to
guess what we mean.

We can define  
        1 * log(0) 
as 
        lim(x->0) 1 * log (x)
and this is unambiguously a negative infinity.

Suppose now we want 
        0 * log(0)
Does this mean
        lim (x->0) 0 * log(x), which is 0 ?
Or does this mean
        lim (x->0) x * log(x), which is 0 ?
Or does this mean
        lim (x->0) (5/(log(x)) * log(x), which is 5?

If you know statistics, you are likely to know that you mean either the
first or the second, but S-Plus cannot expected to recognize and guess
that it is a binomial likelihood calculation.  Hence the NA is an appropriate
response.


-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>