OT: log(0) - NaN, NA, ‘.’, –∞, or empty [General Sta­tis­tics]

posted by Helmut Homepage – Vienna, Austria, 2014-03-12 16:31 (4479 d 04:30 ago) – Posting: # 12607
Views: 11,811

Dear Detlew,

Phoenix:
x = 0
Data Transformation > Functions > LN(x)
Result: empty

No warnings whatsoever. :cool:

R:

>log(0)

[1] -Inf


Cough, if one doesn’t know the answer, improvise! I have some sympathies for R’s approach, since $$\small{\lim_{x \to 0}\log_{e}x=-\infty}$$;-)
R is strong in presenting the limit of a function even if it is undefined for the value in a strict sense:

x <- c(0, 1, 2)
y <- 1 / x
y
# [1] Inf 1.0 0.5
z <- 1 / y
z
# [1] 0 1 2
res <- data.frame(x = x, y = y, z = z)
names(re)[2:3] <-c("y=1/x", "z=1/y")
print(res, row.names = FALSE)
 x   y z
 0 Inf 0
 1 1.0 1
 2 0.5 2

isTRUE(all.equal(res$x, res$z))
# [1] TRUE


Reach for the stars,
even if you have to stand on a cactus.
Susan Longacre


Whether this does make sense in the real world, is another story.

x <- c(rep(10, 23), 0)
y <- mean(log(x))
geo_mean <- exp(y)
geo_mean
# [1] 0

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes

Complete thread:

UA Flag
Activity
 Admin contact
23,654 posts in 4,992 threads, 1,571 registered users;
136 visitors (0 registered, 136 guests [including 15 identified bots]).
Forum time: 22:02 CEST (Europe/Vienna)

Always listen to experts.
They’ll tell you what can’t be done and why.
Then do it.    Robert A. Heinlein

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5