Set: Problems class, Thursday 28th March 2024.
Due in: Problems class, Thursday 18th April 2024. Paper copies may be submitted in the problems class or directly to me in lectures or my office, 4W4.10. Pdf copies may be submitted to the portal available on the Moodle page.
Task: Attempt questions 1(a), 1(b), 2; question 1(c) is an optional question whilst questions 3 and 4 are extra questions which may be discussed in the problems class.
Consider the integral \[\begin{eqnarray*} I & = & \int_{0}^{10} \exp(-2|x-5|) \, dx. \end{eqnarray*}\]
Suppose that \(X \sim U(0, 10)\) with probability density function \[\begin{eqnarray*} f(x) & = & \left\{\begin{array}{cl} \frac{1}{10} & 0 \leq x \leq 10, \\ 0 & \mbox{otherwise.}\end{array}\right. \end{eqnarray*}\] Show that \(I = E_{f}(10\exp(-2|X-5|))\), the expectation of \(10\exp(-2|X-5|)\) calculated with respect to the probability density function \(f(x)\). Hence, explain how to use the method of Monte Carlo integration to estimate \(I\).
Explain how to estimate \(I\) using the method of importance sampling where we sample from the \(N(5, 1)\) distribution.
Use R to explore the methods used in parts (a) and (b). Which method do you prefer?
Suppose that \(f(\theta \, | \, x) = cg(\theta)\) where \(g(\theta) \propto f(x \, | \, \theta)f(\theta)\) and \(c\) is the normalising constant. For a function \(h(\theta)\) we wish to find \(E(h(\theta) \, | \, X) = E_{f}(h(\theta))\) where \[\begin{eqnarray*} E_{f}(h(\theta)) & = & \int_{-\infty}^{\infty} h(\theta)f(\theta \, | \, x) \, d\theta. \end{eqnarray*}\] Suppose that we sample \(N\) values \(\theta_{1}, \ldots, \theta_{N}\) independently from a distribution with probability density function \(q(\theta)\) (you may assume that the support of \(q(\theta)\) is the same as \(f(\theta \, | \, x)\)).
Show that \(E_{f}(h(\theta)) = c E_{q}\left(\frac{h(\theta)g(\theta)}{q(\theta)}\right)\), where \(E_{q}(\cdot)\) denotes expectation calculated with respect to the probability density function \(q(\theta)\). If \(c\) is known, explain how to use \(\theta_{1}, \ldots, \theta_{N}\) to estimate \(E_{f}(h(\theta))\).
Suppose that \(c\) is unknown. By noting that \[\begin{eqnarray*} c^{-1} & = & \int_{-\infty}^{\infty} g(\theta) \, d\theta, \end{eqnarray*}\] explain how to use \(\theta_{1}, \ldots, \theta_{N}\) to estimate \(c^{-1}\).
In the case when \(c\) is unknown, suggest a sensible way of using \(\theta_{1}, \ldots, \theta_{N}\) to estimate \(E_{f}(h(\theta))\).
Let \(X \sim N(0, 1)\).
Explain how to use Monte Carlo integration to estimate \(P(X > a)\) for \(a \in \mathbb{R}\).
What are the difficulties with the method for large values of \(a\)?
Suppose instead we consider estimating \(P(X > a)\) using the method of importance sampling where we sample from \(N(\mu, 1)\). By considering the case when \(a = 3\) and \(\mu = 4\) and that when \(a = 4.5\) and \(\mu = 4.5\) comment on the advantages of this approach over direct Monte Carlo integration.
Explain how to estimate \(P(X > 4.5)\) using the method of importance sampling where we sample from the \(\mbox{Exp}(1)\) distribution truncated at 4.5 which has probability density function \[\begin{eqnarray*} q(x) & = & \left\{\begin{array}{ll} \exp\{-(x-4.5)\} & x > 4.5, \\ 0 & \mbox{otherwise.}\end{array}\right. \end{eqnarray*}\]
Let \(E_{f}(g(X))\) denote the expectation of \(g(X)\) with respect to the probability density function \(f(x)\) so that \[\begin{eqnarray*} E_{f}(g(X)) & = & \int_{X} g(x)f(x) \, dx. \end{eqnarray*}\] Suppose that we sample \(N\) independent observations from a distribution \(q(x)\) and use the method of importance sampling to estimate \(E_{f}(g(X))\). Our estimator is thus \[\begin{eqnarray*} \hat{I} & = & \frac{1}{N} \sum_{i=1}^{N} \frac{g(X_{i})f(X_{i})}{q(X_{i})}. \end{eqnarray*}\] Prove that the choice of \(q(x)\) which minimises \(Var_{q}(\hat{I})\), the variance of \(\hat{I}\) calculated with respect to \(q(x)\), is \[\begin{eqnarray*} q^{*}(x) & = & \frac{|g(x)|f(x)}{\int_{X} |g(z)|f(z) \, dz}. \end{eqnarray*}\] [Hint: First show that it is equivalent to find the choice of \(q(x)\) which minimises \(E_{q}\left(\left(\frac{g(X)f(X)}{q(X)}\right)^{2}\right)\) and then consider \(Var_{q}\left(\frac{|g(X)|f(X)}{q(X)}\right) \geq 0\).]