-1

Python function np.random.multivariate_normal(mean, cov, n) generates NORMAL random series with given covariance and mean. I would like to generate random series with given covariance and mean, but NOT NORMAL. Is there such a funcion IN PYTHON?

In my case I have time series for 10 stock returns. Those returns are not normal-distributed. I want to simulate 5000 returns for each stock, in such a way that they have same mean and covariance as my original stocks returns. I don't want those simulated returns to be normal-distributed, but rather to have a distribution similar to the original stocks.

Rick
  • 79
  • 9
  • You're going to have to narrow this down a mite, since there are an infinite number of distributions that are not normal. – pjs Oct 21 '19 at 17:50
  • Excuse my bluntness here, but this is about as silly as saying "I want to know how to do care and feeding of an animal that isn't a squirrel." How do you expect anybody to give you a meaningful answer to such an open-ended question? The concept of care and feeding may be very clear, but the specifics can vary to extremes depending on what this unspecified animal actually is. – pjs Oct 21 '19 at 22:58
  • I forgive your blutness. But the question is correct. I want to tackle an unknown distribution. I think the answer lays in GMM. – Rick Oct 24 '19 at 13:32
  • Please skim the index of Luc Devroye's textbook on [Non-Uniform Random Variate Generation](http://www.eirene.de/Devroye.pdf). It's nearly 800 pages of very dense material, because the correct way to generate RVs depends entirely on the distribution. Going back to the critter analogy, neither a shark nor a gerbil is a squirrel, but proper care and feeding of a shark is entirely different from that for a gerbil. Since the only information you've provided is that your distribution is not normal, there's no way anybody here can provide a meaningful answer. – pjs Oct 24 '19 at 14:00

1 Answers1

-1

You can reach a random distribution you'd like by mapping a uniform distribution to an inverse CDF function (edit: if it has a closed form CDF, like @pjs mention below) of your distribution.

here is a good SO resource. and here is a good explanation how to do it

Lior Cohen
  • 5,570
  • 2
  • 14
  • 30
  • No, you can't. Not all distributions have closed form CDFs. That's why there are a variety of non-inverse methods for generating RVs, such as convolution, composition, acceptance/rejection, and a whole bunch of special-case tricks. See [Devroye](http://www.eirene.de/Devroye.pdf) for lots and lots of details. – pjs Oct 21 '19 at 18:03
  • fixed - removed the "any" word – Lior Cohen Oct 21 '19 at 18:11
  • It's still not a true statement unless you know what specific distribution Rick wants, and know that it has a closed form CDF which is an invertible function. – pjs Oct 21 '19 at 18:14
  • the distribution doesnt have any specific form. It is a distribution of stock returns, which can be anything. – Rick Oct 21 '19 at 19:27