[SciPy-User] scipy.stats: Sampling from an arbitrary probability distribution

nicky van foreest vanforeest at gmail.com
Mon Jun 4 16:07:11 EDT 2012


Hi

Maybe this article is of help

http://www.google.com/url?sa=t&rct=j&q=plehn%20bruns&source=web&cd=2&ved=0CFoQFjAB&url=http%3A%2F%2Fwww.logistics-journal.de%2Fnot-reviewed%2F2005%2F7%2Fapproximation%2FApproximation_and_Computation_of_Random_Variables_using_Finite_Elements.pdf&ei=CRXNT4eyC6ik4gSoqYWPDA&usg=AFQjCNFLF-Zr3w6opNHWsM3HYGUaTqK8vA

Nicky
On Jun 4, 2012 3:22 PM, "Sturla Molden" <sturla at molden.no> wrote:

> On 03.06.2012 13:20, Daniel Sabinasz wrote:
> > Hi all,
> >
> > I need to sample a random number from a distribution whose probability
> > density function I specify myself. Is that possible using scipy.stats?
>
> Sampling a general distribution is typically an MCMC problem, that e.g.
> can be solved with the Metropolis-Hastings sampler.
>
> http://en.wikipedia.org/wiki/Metropolis%E2%80%93Hastings_algorithm
>
> Because of its recursive nature, a Markov chain like this is better
> written in Cython, or you can use NumPy to run multiple chains in
> parallel. (I depends on how many samples you need, of course, anything
> below a million should be fast enough in Python.)
>
> You might also take a look at PyMCMC:
> https://github.com/rdenham/pymcmc
>
>
> Sturla
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20120604/55840fa4/attachment.html>


More information about the SciPy-User mailing list