On 23-Apr-07 04:41:03, ecatchpole wrote:
> dgamma(x=1, shape=nu, rate=nu, log=TRUE)
> [1] -2.045951
> 
> This is a good example of why you should call parameters by name.
> 
> Ted.

True up to the point that the "log" parameter is in the 5th
position in the list of dgamma paramaters, so if its value is
given in any other position (here the 4th) then it needs to be
named. The other arguments are given in the positions where
dgamm() expects to find them:

  dgamma(x, shape, rate = 1, scale = 1/rate, log = FALSE)

Hence:

  > dgamma(1,nu,nu,log=TRUE)
  [1] -2.045951
  > dgamma(1,nu,nu,log=FALSE)
  [1] 0.1292572
  > dgamma(1,nu,nu,log=1)
  [1] -2.045951
  > dgamma(1,nu,nu,log=0)
  [1] 0.1292572

all work as expected. Tong Wang was in fact setting "scale".
Ted (Harding)

> Tong Wang wrote on 04/23/2007 01:59 PM:
>> 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 ?
>> I am using R-2.4.1 on windows XP.
>>
>> Thanks a lot.
>>
>> ______________________________________________
>> [email protected] 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.
>>   
> 
> 
> -- 
>  Dr E.A. Catchpole  
>  Visiting Fellow
>  Univ of New South Wales at ADFA, Canberra, Australia
>     _   and University of Kent, Canterbury, England
>    'v'          - www.pems.adfa.edu.au/~ecatchpole          
>   /   \         - fax: +61 2 6268 8786                   
>    m m    - ph:  +61 2 6268 8895
> 
> ______________________________________________
> [email protected] 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.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 23-Apr-07                                       Time: 10:26:01
------------------------------ XFMail ------------------------------

______________________________________________
[email protected] 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.

Reply via email to