I am confused by the special way required to use inverse method in the following problem,
Here is the problem:
Consider a mixture distribution of two normal distributions, where the desired PDF $f(x)$ is given by:
$f(x) = r\, f_a(x) + (1 − r)\, f_b(x)$,where $f_a$ and $f_b$ are normal PDFs with means $a$ and $b$, respectively (standard deviation is 1 for both). Using two uniform random variables $u_1$ and $u_2$, explain how we can use the inversion method to sample from $f(x)$. Note, the
qnorm
command in R may be helpful here.
My confusion is from "two uniform random variables $u_1$ and $u_2$". My thought is that we find out the cdf, $F(x)$ (which can be obtained via pnorm()
in R), and then we can use some numerical method (such as Newton-Raphson) to generate $x\sim f(x)$, so here it only needs one uniform distribution and does not need qnorm()
.
What's wrong with my method? Does the problem suggest a better method?