Charles Danko wrote:> Hi, All,
>
> I am getting some funny results trying to use R's built in
> distribution functions.
>
> In R:
>> dgamma(4.775972,1.37697964405418, 0.106516604930466)
> [1] 0.05585295
>> dgamma(4.775972,1.37697964405418, 0.106516604930466,TRUE) ### THIS IS
JUST WRONG!
> [1] 0.01710129
>> log(dgamma(4.775972,1.37697964405418, 0.106516604930466))
> [1] -2.885033
>
> In C:
> dgamma(4.775972,1.37697964405418, 0.106516604930466,TRUE)
> Returns: -41.046764
>
> dgamma(4.775972,1.37697964405418, 0.106516604930466,FALSE)
> Returns: 0.000000
>
> SESSION INFO:
> R version 2.9.0 (2009-04-17)
> x86_64-unknown-linux-gnu
>
> Any indication of what I may be doing wrong is very much appreciated.
Not reading the documentation?
> args(dgamma)
function (x, shape, rate = 1, scale = 1/rate, log = FALSE)
NULL
> dgamma(4.775972,1.37697964405418,, 0.106516604930466,TRUE)
[1] -41.04676
> dgamma(4.775972,1.37697964405418,, 0.106516604930466,FALSE)
[1] 1.491480e-18
> log(dgamma(4.775972,1.37697964405418,, 0.106516604930466,FALSE))
[1] -41.04676
> dgamma(4.775972,1.37697964405418,0.106516604930466,log=TRUE)
[1] -2.885033
>
> Thanks,
> Charles
>
>
--
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907