# Sampling according to a difference of two normal distributions

Assuming that I have two normal distributions $p_1(x)$ and $p_2(x)$ and I can draw samples efficiently from them.

Now, I can easily draw samples from $p(x) = 0.5 p_1(x) + 0.5 p_2(x)$ by with probability = 50% taking a sample from $p_1$ and probability = 50% taking a sample from $p_2$.

Is there any similar way that I can efficiently draw samples from a difference of two distributions? For example $p(x) = 1.5 p_1(x) - 0.5 p_2(x)$, assuming that $p(x) > 0$?

• Note that your proposed method to sample from the positive mixture is incorrect, because in any random sample it is more likely than not that one of the mixture components is represented more than the other. Just consider the problem you run into for a sample size that is an odd number! Are you sure you are not confusing mixtures with linear combinations of random variables? The sum (or mean) of two normal variates does not have the average of the PDFs for its PDF. – whuber Nov 21 '14 at 17:31
• I think I made a mistake when saying "with 50% taking..". I meant for each sample, I flip a coin and with probability = 50% I get that sample from $p_1(x)$ and with probability = 50% I take from $p_2(x)$. – mushin Nov 22 '14 at 9:06
• Ok, that's a mixture and now you have correctly described how to draw a sample from it (which differs from the description in the question). But then what does "$1.5p_1(x)-0.5p_2(x)$" mean? You can't flip a coin having probabilities of $1.5$ and $-0.5$! – whuber Nov 22 '14 at 15:29 In cases where $p(x) = 1.5 p_1(x) - 0.5 p_2(x)$ is sure to be non-negative, it's at least a density, and you can generate samples from it, for example by accept-reject (e.g. using $1.5 p_1(x)$ as majorizing function).
• Thanks! We do have the constraint that $p(x)$ is positive. I have thought about rejection sampling; however this is a bit inefficient. Thus, I was looking for some direct sampling strategy similar to the case of mixture distribution. – mushin Nov 22 '14 at 9:10