[R] Problem with dgamma ?

Peter Dalgaard
Mon, 23 Apr 2007 06:21:19 -0000

Tong Wang wrote:
> Hi All,
>      Here 's what I got using dgamma function :
>
>
>> nu<-.2
>> nu*log(nu)-log(gamma(nu))+(nu-1)*log(1)-nu*(1)
>>
> [1] -2.045951
>
>
>> dgamma(1,nu,nu,1)
>>
> [1] 0.0801333
>
>
>> dgamma(1,nu,nu,0)
>>
> [1] NaN
> Warning message:
> NaNs produced in: dgamma(x, shape, scale, log)
>
> Could anyone tell me what is wrong here ?
>
Did you intend the 4th argument to match the log formal argument? It
doesn't:

 > args(dgamma)
function (x, shape, rate = 1, scale = 1/rate, log = FALSE)
NULL


> I am using R-2.4.1 on windows XP.
>
> Thanks a lot.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>