[SciPy-user] Generating random variables in a joint normal distribution?
Robert Kern
robert.kern@gmail....
Thu Nov 1 03:09:00 CDT 2007
Parvel Gu wrote:
> Hi,
>
> Thanks so much for the reply. I could go furthur in this problem.
>
> And here is the following issue:
>
> In my understanding, the continues calls to random.multivariate_normal
> would get a serials of random vairables which are all following the
> joint normal distribution. Then what about how to reset the random
> generating in each iteration?
>
> Assuming that I have to simulate something for 50 iterations then to
> get the average value. In each iteration I need a serial of random
> pairs which follows the joint normal distrubition. The interations are
> expected to be independent to each other.
>
> Thus:
>
> In iteration 1:
> serial = []
> in sub loop
> serial.append(random.multivariate_normal(m, cov))
> ...
>
> And in iteration 2, I want a fresh serial which should not be affected
> by the previous one s. Is there any problem to empty the serial
> then still call random.multivariate_normal(m, cov) ?
> In my understanding if there is no refresh or something performed to
> the internal random generator, the random.multivariate_normal would
> continue to generate variables in the context of the previous ones.
Just keep sampling. The samples will be as independent of each other as you can
possibly get them. Reseeding the generator (the only thing I can imagine that
you meant by "refresh or something") will only make things worse.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the SciPy-user
mailing list