On Mon, Jul 4, 2011 at 10:13 PM, Ted To <rainexpected@theo.to> wrote:
Hi,
Is there an easy way to make random draws from a conditional random variable? E.g., draw a random variable, x conditional on x>=\bar x.
If you mean here truncated distribution, then I asked a similar question on the scipy user list a month ago for the normal distribution. The answer was use rejection sampling, Gibbs or MCMC. I just sample from the original distribution and throw away those values that are not in the desired range. This works fine if there is only a small truncation, but not so well for distribution with support only in the tails. It's reasonably fast for distributions that numpy.random produces relatively fast. (Having a bi- or multi-variate distribution and sampling y conditional on given x sounds more "fun".) Josef
Thank you, Ted To _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion