[SciPy-user] Monte Carlo package

David Huard david.huard at gmail.com
Wed Jan 25 16:26:09 CST 2006


Thanks for the advice,

Indeed, the parameters of the distribution will change for each sample, so
the numerical integration and inversion is probably not a good choice. I
think I'll use PyMC mixed with Gibbs sampling using the stats.rvs routines.
I'll let you know how it goes.

By the way, I'd like to thank you for all the work you're putting into scipy
and numpy. The gaussian_kde class along with PyMC make Bayesian analyses a
breeze. It's easy to be productive when you work with such good tools.

David


2006/1/25, Travis Oliphant <oliphant at ee.byu.edu>:
>
> David Huard wrote:
>
> > I mean an arbitrary user-defined distribution. I want to generate
> > samples using a Gibbs sampler, and one of the conditional distribution
> > has a weird shape involving a sum of logs... Anyway, there is no
> > chance that I can find an analytical expression for this cdf and I
> > wondered if there was a routine somewhere that would let me define the
> > function and would return samples drawn from this distribution. I
> > thought about that since the intsampler of montecarlo does something
> > similar for discrete distributions.
> >
> Well in SciPy stats, there is some (limited) support for this.  If you
> can define the pdf, then it will first numerically integrate that to get
> the CDF and then invert that to generate samples from the distribution.
> It will be slow and the convergence of the two piggy-backed numerical
> solutions might give you headaches, but...
>
> You might try using the rejection algorithm.   There is no simple
> interface to such a thing though.  It might be a good thing to add (i.e.
> specify a known density and a constant so that cg(x) bounds and then
> your pdf and then have it generate samples using the rejection method.
>
> -Travis
>
>
>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.scipy.net/pipermail/scipy-user/attachments/20060125/6c97760d/attachment.htm


More information about the SciPy-user mailing list