$$ \require{cancel} \newcommand{\given}{ \,|\, } \renewcommand{\vec}[1]{\mathbf{#1}} \newcommand{\vecg}[1]{\boldsymbol{#1}} \newcommand{\mat}[1]{\mathbf{#1}} \newcommand{\bbone}{\unicode{x1D7D9}} $$

Tutorial 4, Week 8

Download as PDF

Q1

We are interested in evaluating the integral \[\int_0^1 x e^{-x} \, dx\]

  1. By noting that \(f_X(x) = \lambda e^{-\lambda x}\) is the probability density function of an Exponential random variable with rate parameter \(\lambda\), write the above integral as an expectation with respect to an Exponential distribution.

  2. Compute the expectation exactly by doing the integration required (Hint: integration by parts)

Because we can compute it exactly, we wouldnโ€™t actually use simulation to approximate it, but this makes it a good example to understand the behaviour of Monte Carlo integration, since we can analytically compute the accuracy too!

  1. Write down a Monte Carlo integration algorithm that estimates the integral using simulations from an Exponential distribution.

  2. Compute the variance of your Monte Carlo estimator. (Hint: use \(\text{Var}(Y) = \mathbb{E}[Y^2] - \mathbb{E}[Y]^2\), and you already know \(\mathbb{E}[Y]\) from (b))

Q2

An alternative way to tackle the above Monte Carlo integral would be to simulate from a finitely supported distribution, so that you donโ€™t need to use the indicator function.

  1. Express the integral from Q1 as an expectation with respect to a Uniform distribution.

  2. Write down a Monte Carlo integration algorithm that estimates the integral using simulations from a Uniform distribution.

  3. Compute the variance of this new Monte Carlo estimator based on Uniform simulations.

Hint: To save some time with integrals, you may use the fact that: \[\int x^2 e^{-2x} \,dx = -\frac{e^{-2x}}{4} (2x^2 + 2x + 1)\]

  1. How many more/fewer simulations would I need with Exponential simulation to achieve the same size confidence interval as under Uniform simulation?

Q3

The following is a valid probability density function for all \(\alpha > 0\), \[f_X(x) = \begin{cases} \alpha x^{\alpha-1} & \text{if } x \in [0,1] \\ 0 & \text{otherwise} \end{cases}\]

  1. Describe how use inverse sampling to generate simulations of a random variable that follow this density.

  2. Express the integral from Q1 as an expectation with respect to a random variable with the above pdf.

  3. Write down a Monte Carlo integration algorithm that estimates the integral using simulations of the above random variable.

  4. Let \(\alpha=2\). Compute the variance of this new Monte Carlo estimator.

Hint: To save some time with integrals, you may use the fact that: \[\int x e^{-2x} \,dx = -\frac{e^{-2x}}{4} (2x + 1)\]

  1. How many more/fewer simulations would I need with Exponential simulation or with Uniform simulation to achieve the same size confidence interval as under simulating this random variable?