Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CFRM 505: Monte Carlo Methods in Finance (Winter 2024)

CFRM Program

Assignment 2

1. Use the inverse transform method to generate X specified as follows:

(a) X = min(U1, U2) where U1 and U2 are IID U(0, 1)

(b) X = max(U1, U2) where U1 and U2 are IID U(0, 1)

(c) X = min(Y1, Y2, Y3) where Y1, Y2, and Y3 are IID exponential with parameter λ.

Then estimate the mean, i.e. E[X], in each of the three cases. Use a sample size (for X) no less than 10,000.

2. Write a Monte Carlo simulation algorithm to generate 10000 samples of the Poisson random variable with rate parameter λ = 1. Give the algorithm and report the mean and variance from your samples.

3. Generate a random variable X with the CDF:

Hint: Consider the composition method. In particular, let F denote the distribution function of X, and suppose that the conditional distribution of X given that Y = y is

Write the algorithm in R/Python to generate 10,000 samples of X with the CDF above. Report the mean and variance from your samples.

4. Give an acceptance-rejection algorithm to generate a random variable with pdf:

Describe your choice of the density function g(x) and constant a. Run your simulation code to generate 100, 000 samples, and compute the average number of iterations that were required until each sample was accepted.

5. Recall from the slides the acceptance-rejection algorithm for simulating X ∼ N(0, 1) that utilizes

Write a simulation code to implement this algorithm to generate 10000 samples of X. Show the histogram of the samples. Estimate E[X] and V ar(X). How many uniforms are used (on average) to generate one sample of X?