[SciPy-user] Monte Carlo package
David Huard
david.huard at gmail.com
Wed Jan 25 13:07:41 CST 2006
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.
I realize that if it was so simple, we wouldn't need MCMC algorithms...
Anyway, I think I'll try to tweak PyMC to mix Gibbs sampling with Metropolis
jumps. I guess that's possible, isn't it ?
Thanks,
David
2006/1/25, Robert Kern <robert.kern at gmail.com>:
>
> David Huard wrote:
> > It builds fine on linux Ubuntu and the example you gave in the mail
> > works fine, however, I'm not sure I understand your question about
> rand().
> > Here is what I get :
> >
> >>>> from scipy.sandbox.montecarlo import *
> >>>> rand()
> > NameError: name 'rand' is not defined
>
> I am referring to the POSIX rand() function in C, which the current
> version of
> the montecarlo package uses to seed a faster generator.
>
> > If I may ask a question, is there a routine in scipy to generate random
> > samples from a continuous distribution ?
>
> Which distribution? numpy.random has plenty of standard continuous
> distribution
> generators. scipy.stats.distributions defines a whole slew of distribution
> objects, each of which has an .rvs() method which samples from the given
> distribution.
>
> --
> Robert Kern
> robert.kern at gmail.com
>
> "In the fields of hell where the grass grows high
> Are the graves of dreams allowed to die."
> -- Richard Harter
>
> _______________________________________________
> 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/082519bd/attachment.htm
More information about the SciPy-user
mailing list