[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] log probability density functions

From: Rodney Sparapani
Subject: Re: [Help-gsl] log probability density functions
Date: Thu, 29 Mar 2012 08:26:17 -0500
User-agent: Thunderbird (X11/20110927)

Sam Mason wrote:

I'm just wondering whether it's deliberate that there aren't any log
probability density functions in the GSL?  I've had a quick search
through the archives and haven't seen anything obvious, but if you
could point me in the right direction that would be great!

As a bit of background, I'm using the GSL for doing Bayesian MCMC
inference and the starting point of a chain tends to be somewhere with
(very) low density.  The lack of log density functions means that
densities will be truncated to zero before I can take the log of them.

For all of the distributions I've looked at in GSL it's been trivial
to rearrange the maths so it's working with log densities and I'd be
happy to tidy up my hacks into a patch if it would be useful to other
people.  Which, as far as I can tell, seems to be anyone doing much
with likelihoods--the product of lots of very small numbers gets
truncated to zero very quickly and working with the log of these is an
easy way of getting sensible results!

Of course, any other suggestions would be appreciated!

Thanks in advance,


Hi Sam:

That is a very good point. Many other packages like R allow you to return the log-density rather than the density. This would be a good addition to GSL. However, I see two problems. 1) as I understand it,
GSL is feature complete at this point.  2) after many years of great
stewardship, Brian Gough has stepped down as maintainer and no one
has stepped up.  So, you can either code your functions as a GSL
extension or maybe you just use the R math library directly.

Rodney Sparapani, PhD  Center for Patient Care and Outcomes Research
Sr. Biostatistician     
4 wheels good, 2 wheels better!   Medical College of Wisconsin (MCW)
WWLD?:  What Would Lombardi Do?   Milwaukee, WI, USA

reply via email to

[Prev in Thread] Current Thread [Next in Thread]