Hi R-users,
I have the following code:
f -function(x,p)sqrt(-(x^2)-2*log(1-p))
r1 -sqrt(-2*log(1-0.95))
r2 -sqrt(-2*log(0.05))
on executing i get the following results
f(r1,0.95)
[1] 0
f(r2,0.95)
[1] NaN
Warning message:
NaNs produced in: sqrt(-(x^2) - 2 * log(1 - p))
I tried to track
Anthony,
in the same way that we're not allowed to say if(x==0) if x is a real
number, we can't say that 0.05=1-0.95... as 1-0.95 is not represented
as a base 10 number on the computer, but in some base 2^i depending on
your computer...and the representation is not necessarily exact...
i.e.
On 5/19/2006 8:25 AM, Gichangi, Anthony wrote:
Hi R-users,
I have the following code:
f -function(x,p)sqrt(-(x^2)-2*log(1-p))
r1 -sqrt(-2*log(1-0.95))
r2 -sqrt(-2*log(0.05))
on executing i get the following results
f(r1,0.95)
[1] 0
f(r2,0.95)
[1] NaN
Warning message:
NaNs
] Precision in estimating log
Hi R-users,
I have the following code:
f -function(x,p)sqrt(-(x^2)-2*log(1-p))
r1 -sqrt(-2*log(1-0.95))
r2 -sqrt(-2*log(0.05))
on executing i get the following results
f(r1,0.95)
[1] 0
f(r2,0.95)
[1] NaN
Warning message:
NaNs produced in: sqrt(-(x^2