I want to randomly sample from a joint probability distribution characterized by two variables x and y. So, basically, I have the information of the joint PDF which has the dimension 100x50.

As per my literature study, the only way to efficiently sample from such a distribution is by employing MCMC algorithms (correct me if I'm wrong). However, I do not know yet where to start from. My knowledge in statistics is quite limited and I have just started learning about sampling techniques. Perhaps, Metropolis-Hastings seems like a good starting point. Any leads on the same would be highly appreciated.

Thanks. :)

  • 1
    $\begingroup$ What is dimension 100x50? Do you mean 100 observations of a 50-variate distribution? $\endgroup$
    – Dave
    Apr 12, 2021 at 20:57
  • $\begingroup$ Can you put some more context in? Is it possible to write the density down? MCMC can be a very inefficient sampler in many cases $\endgroup$
    – jcken
    Apr 12, 2021 at 20:59
  • $\begingroup$ So, in the data, the variable x ranges from 1 to 50 and variable y ranges from 1 to 100. I have it in matrix form where each cell has a probability value associated with the (x,y) pair. I do not think this could be considered as a 50-variate distribution. $\endgroup$
    – leo31
    Apr 12, 2021 at 21:14
  • $\begingroup$ If each random variable has a finite set of possible values then it's a joint probability mass function rather than a joint probability density function. It sounds like you know the exact probability of each of the 5000 possible outcomes, in which case you could just use numpy.random.choice (stackoverflow.com/a/26196078) or an equivalent algorithm to draw each sample - no need to use MCMC. $\endgroup$
    – fblundun
    Apr 12, 2021 at 22:11
  • $\begingroup$ This is a discrete distribution with 5000 members in the state space. $\endgroup$
    – whuber
    Apr 12, 2021 at 22:11


Browse other questions tagged or ask your own question.