5
$\begingroup$

I've been trying to use the chaospy package to get quasi-random numbers for a Monte Carlo simulation. The dimensions need to be 365×5000 (but can be up to 2190×5000).

When I pull a sample using chaospy.J(chaospy.Normal(0, 1)), I get an array of random numbers, but they are only normally distributed along one axis. The other axis appears to be uniformly distributed.

I'm trying to find the best way to get these numbers normally distributed. I've read in a few places that you can take another uniform distribution, add it and take mod 1 (i.e. (ranom.uniform() + sample) % 1). That seems like it defeats the purpose a bit. Is there a better way to do this? Also, if anyone has some better suggestions of packages to use, I would be open to that.

$\endgroup$
2
  • $\begingroup$ Do you mean that you want to sample from a multivariate normal distribution? If so then random.multivariate_normal from numPy should do the trick. This is probably off topic here btw. $\endgroup$ Commented Nov 13, 2020 at 16:49
  • $\begingroup$ @RobertLong I'm not sure where else to ask this. I'm currently using numpy for this, but I would prefer to use some method of variance reduction. $\endgroup$
    – Kevin K.
    Commented Nov 13, 2020 at 17:05

1 Answer 1

4
$\begingroup$

Quasi-montecarlo numbers are uniform, but not independent. Transforming to other distributions than uniform, will work as with pseudorandom numbers, as long as the transformation uses only one random number, as with the inversion method. Algorithms with two or more random inputs will break down. So for a normal distribution, inversion will work, but not the Box-Muller method (see Best method for transforming low discrepancy sequence into normal distribution?) The paper Generating low-discrepancy sequences from the normal distribution: Box–Muller or inverse transform? by Giray Ökten and Ahmet Göncü argues otherwise.

But this is the univariate case, you seem to want a multinormal distribution. I will try to come back to that ...

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.