lgamma is the log of gamma. We use it to obtain the numerical stability:
recall that gamma(x) is a factorial when x is an integer (so, it's a big
number and taking the log of it will make it smaller). For the density
calculation, you should *always* take log and then at the end take exp to
get it back to the original scale.
Kosuke
On Sat, 1 Mar 2003, Andrew Reeves wrote:
Kosuke,
Why do you use lgamma() in your code for homework 2? What's the
difference between lgamma and gamma? (I know they give you different
values in R).
Andrew
--
Andrew Reeves
reeves(a)fas.harvard.edu
617.493.3485 tel.
301.639.8369 cell.
http://people.fas.harvard.edu/~reeves/
_______________________________________________
gov2001-l mailing list
gov2001-l(a)fas.harvard.edu
http://www.fas.harvard.edu/mailman/listinfo/gov2001-l