[SciPy-User] log pdf, cdf, etc

josef.pktd at gmail.com josef.pktd at gmail.com
Sat May 29 10:46:14 EDT 2010


On Sat, May 29, 2010 at 1:15 AM, John Salvatier
<jsalvati at u.washington.edu> wrote:
> The package PyMC(http://code.google.com/p/pymc/) contains fortran log
> likelihood functions for a lot of distributions, but you would have to look
> at the source code to figure out how to use them since they are meant mostly
> for internal use. They are not ufuncs but can handle arrays or single values
> for each parameter. A recent PyMC branch also contains similar log
> likelihood gradient functions for the same distributions
> (http://github.com/pymc-devs/pymc/tree/gradientBranch).

Thanks, I will have a look at the gradient branch


To get started, I added a test script to the ticked that makes it
easier to add and test new methods for lnpdf and lncdf.  It's adapted
from the scipy tests and tests all distributions that have a _lnpdf or
_lncdf method.

The new methods can just be added to the script to monkey patch
scipy.stats.distributions.

I monkey patched 13 easy cases so far, mainly to check that the script
works. (Still far too go for full coverage of cases where this makes
sense.)

The tests use nosetests and test for (almost) equality of the new
methods with the log of the old methods, and check a simple
broadcasting case.

Everyone is invited to add new cases, and to report any problems with
the script.

I hope that helps to get the ball rolling.

Josef

>
> Hope that is useful.
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>



More information about the SciPy-User mailing list