IEDA4520 Numer. Methods for Fin. Eng. Fall 2023 Assignment 1 Due Oct 2, 23:59 pm You may write your solutions in a Jupyter Notebook or R Markdown and convert it into a PDF. Please submit both your code and the PDF on Canvas. You are allowed to discuss with your peers, but you should independently work on the codes and answers. Plagiarism will not be tolerated. 1. Assume that the density of X can be written as f (x) = cg(x)H̄(x), where g(x) is the density of an random variable Y and H̄(x) = P(Z > x) is the tail of an random variable Z. Show that X can be generated by sampling Y and Z independently and rejecting until Y ≤ Z. 2. A Weibull distribution has the following density function α f (x) = β α−1 x α e−(x/β) , β x ≥ 0, where α > 0 and β > 0. Assume you have a pseudo-random number generator but no other random variable generators. (a) How would you use the inverse transform method to generate such a random variable? (b) How would you use the acceptance-rejection method to generate such a random variable? Please write down your mathematical derivation and implement your algorithms either in Python or R (say, generate 10,000 samples and compare the histogram with the above density function). 3. The Box-Muller transform is one way to generate pairs of independent standard normal random variables. However, it requires computing sine and cosine functions, which is quite expensive. Marsaglia and Bray purposed a modification in their paper entitled A Convenient Method for Generating Normal Variables published on SIAM Review. The key idea is to generate uniform samples from the uniform distribution over the interval between −1 and 1, and use only those samples within the unit circle. It avoids computing trigonometric functions. The modified version is summarized into the following steps. (i) Generate U1 , U2 ∼ Unif[0, 1]. (ii) Set V1 = 2U1 − 1, V2 = 2U2 − 1 and T = V12 + V22 . (iii) If T ≤ 1, proceed to (iv). Otherwise, go back to (i). (iv) Return r X= −2 ln T V1 , T r Y = −2 ln T V2 . T Write a program in Python or R to implement this method. Again, generate 10,000 samples, plot the histogram and compare it to the standard normal density function. 4. Suppose that the price of an asset is modeled as a geometric Brownian motion dS(t) = rdt + σdW (t). S(t) Page 1 of 2 IEDA4520 Numer. Methods for Fin. Eng. Fall 2023 Assignment 1 In this problem, you are asked to use simulation to price Asian options. (a) An Asian option has a payoff that depends on the time average of the underlying asset. For instance, assume the payoff at the expiration date T is F (S) = (S̄ − K)+ , where the strike price K is a constant and n S̄ = 1X S(ti ) n i=1 is the average price over the monitoring dates t1 , . . . , tn . Such an Asian option is called an average price option and it is cash-settled in the sense that the seller of the option pays in cash at time T . (b) Another type of Asian options is average strike options and it has the payoff F (S) = (S(T ) − S̄)+ . Average strike options can be either cash-settled or physically settled (which means the owner of the option has the right to purchase the underlying asset at the price S̄ at time T from the seller of the option). Assume r = 1.5%, σ = 40%, S(0) = 100RMB, K = 120RMB, and T = 1 year. Write a Python or R code to estimate the price of the two types of Asian options, i.e. E[e−rT F (S)] and also provide 95% confidence intervals. Page 2 of 2