Say you have 100000 samples u from a uniform distribution and 100000 samples y from a Cauchy distribution. Derive a condition that u and y must satisfy in order for some y_i to be accepted as a sample from a standard normal distribution.
Assistant
To derive a condition for accepting a sample from the Cauchy distribution as if it were from a standard normal distribution, you can use acceptance-rejection sampling, also known as rejection sampling. The idea is that you can use samples from an easy-to-sample distribution (in this case, the uniform or the Cauchy distribution) to generate samples from another distribution (the standard normal distribution). To do this, you need a proposal distribution that you can sample from, and its density must dominate the target density multiplied by some constant.
User
But what is the condition u and y must satisfy?
Assistant
Apologies for the confusion earlier. Let's derive the explicit condition that a pair of samples ( u_i ) and ( y_i ) must satisfy for ( y_i ) to be accepted as a sample from the standard normal distribution using the acceptance-rejection sampling method.
Given that ( f(x) ) is the probability density function (pdf) for the standard normal distribution and ( g(x) ) is the pdf for the Cauchy distribution:
Let's use the Cauchy distribution as the proposal distribution (which you've denoted by "y") and the standard normal distribution as the target distribution (which we're trying to sample from). The standard normal distribution has the following probability density function (pdf):
Now, choose ( c = \sqrt{2/\pi} ), so that ( c ) is the smallest value that satisfies ( cg(x) \ge f(x) ) for all x.
The rejection sampling algorithm is as follows:
Sample ( y_i ) from the Cauchy distribution.
Sample ( u_i ) from the uniform distribution ( U(0,1) ).
Calculate an acceptance probability:
[ a = \frac{f(y_i)}{cg(y_i)} ]
Accept ( y_i ) as a sample from the standard normal distribution if ( u_i < a ); otherwise, reject ( y_i ) and go back to step 1.
Note that ( c ) is specific to the pair of distributions chosen, so if we were to use another distribution instead of the Cauchy as our proposal, we would have to calculate a new ( c ) value.
Also, because the tails of the Cauchy are much «heavier» than those of the normal distribution, many samples will be rejected using this rule, making this method potentially inefficient. There may be more efficient algorithms for sampling from the standard normal distribution, such as the Box-Muller transform or the Ziggurat algorithm.
And we have found that ( c = \sqrt{2/\pi} ) such that ( cg(x) \ge f(x) ) for all ( x ). The condition for acceptance, given a uniform random sample ( u_i ) and a Cauchy distributed random sample ( y_i ), is:
[ u_i < \frac{f(y_i)}{cg(y_i)} ]
Substitute ( f(y_i) ) and ( cg(y_i) ) into the above inequality:
So, the condition that ( u_i ) (sample from the uniform distribution) and ( y_i ) (sample from the Cauchy distribution) must satisfy in order for ( y_i ) to be accepted as a sample from the standard normal distribution is:
If this condition holds, we accept ( y_i ) as a sample from the standard normal distribution. If it doesn't hold, we reject ( y_i ) and repeat the process with new samples of ( u ) and ( y ).