[Rd] dgamma density values in extreme point

Alexey Burnakov burnakov at yandex.ru
Sun Nov 13 19:43:03 CET 2016


Dear R-Devel group,

My name is Alexey, a data scientist from Moscow, currently working for 
Align Technology Inc.

We have recently had a discussion of the results that the dgamma 
function (stats) returns for an extreme point (x == 0).


<dgamma(0,1,1,log = FALSE)

[1] 1


and

<dgamma(0,0.5,1,log = FALSE)
[1] Inf

Density appears to be defined in point zero for the distribution with 
the said parameters.

It looks like the returned value is a limit of f(x) where x --> inf.

Although several other "big" statistics engines like Wolfram and Matlab 
return 0 (zero) for gamma density with the same function parameters 
where x == 0. Which looks like a convention rather than exact answer, in 
our opinion. Is this a correct assumption?

When studies scrupulously, it appears that the density is undefined when 
we get x^0 where x == 0, for example.

As I could not have reached the author of the code for dgamma, could you 
comment on this behavior of the dgamma function in zero? Is it safe to 
use the function given such behaviour. Is it prudent to report density = 
inf in zero? Is there a preferable way to estimate the gamma density in 
zero otherwise?

Regards,
Alexey Burnakov



More information about the R-devel mailing list