[Rd] Re: [R] too large alpha or beta in dbeta ? (PR#643)
Fri, 25 Aug 2000 15:20:10 +0200 (MET DST)
>>>>> "TL" == Thomas Lumley <email@example.com> writes:
TL> On Thu, 24 Aug 2000, Troels Ring wrote:
>> Dear friends.
>> Is this as expected ? Is alpha and beta too large simply ?
>> > dbeta(.1,534,646)
>>  NaN
>> Warning message:
>> NaNs produced in: dbeta(x, shape1, shape2, log)
TL> well, it should work, but the correct answer is effectively zero.
TL> pbeta(.1,534,646) gives 3.6e-213
TL> Perhaps more worrying is
TL>  Inf
and I see that it is one case where the log-density seems to be alright:
and also for the NaN case :
> dbeta(.1,534,646, log=TRUE)
A workaround is using exp( log-density ), i.e.
exp(dbeta(x,a,b, log = TRUE)) :
> plot(function(x) dbeta(x, 534,646, log = TRUE), n = 1001)
> plot(function(x)exp(dbeta(x, 534,646, log = TRUE)), n = 1001)
I'll have a look.
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: firstname.lastname@example.org