Exercise 4
Rejection Algorithms for the Standard Normal Random Variable
This exercise focuses on using rejection sampling to generate standard normal random variables with different instrumental densities.
Part a
- Provide a rejection algorithm to generate \(\mathcal{N}(0,1)\) random variables, where the instrumental density is Cauchy: \[ g(x) = \frac{1}{\pi (1 + x^2)}, \quad x \in \mathbb{R} \]
- Determine the efficiency of this algorithm.
Part b
Develop an algorithm that generates realizations from a double exponential (Laplace) distribution, with density: \[ g(x) = \frac{\alpha}{2} \exp(-\alpha |x|), \quad \alpha > 0, \; x \in \mathbb{R} \]
- Formulate a rejection algorithm to generate \(\mathcal{N}(0,1)\) random variables, where the instrumental density is a double exponential distribution.
- Find the optimal value of the parameter \(\alpha\) for this density, and determine the corresponding efficiency.
Part c
Implement the above algorithms in
R
, using functions such asrcauchy
,runif
,rexp
, orabs
where appropriate.Empirically verify the theoretical efficiencies of each algorithm.