Answered step by step
Verified Expert Solution
Question
1 Approved Answer
H OMEWORK 1 Homework 1 is due by Wednesday September 21st at 5:00 pm. In this HW we study some methods used to answer the
H OMEWORK 1 Homework 1 is due by Wednesday September 21st at 5:00 pm. In this HW we study some methods used to answer the following question: How can we generate n random samples from some distribution with c.d.f. F (or density f )? (1) Inverse of the c.d.f. method. Suppose that U1 , . . . , Un are i.i.d. samples from the uniform distribution on the interval (0, 1). Let F be a c.d.f. which we assume is invertible (we denote by F 1 its inverse). What can you say about the distribution of the random variables F 1 (U1 ), . . . , F 1 (Un )? In particular, what is their c.d.f. ? Use the function rand in Matlab to produce 100 samples from the uniform distribution on (0, 1) and use your answer to the previous question to produce 100 samples from the exponential distribution with parameter = 2 (we are considering the mean as the parameter for the exponential distribution). Attach a histogram of your samples. Remark: The inverse of the c.d.f. method is the easier way to produce samples from a distribution with c.d.f F using samples from the uniform distribution. This provided we can explicitly compute F 1 (take a look at Question 2 below for an example where this may not be the case). (2) Box-Muller method to obtain samples from the standard normal distribution. Suppose you wanted to simulate n samples from the standard normal distribution N (0, 1). Why is the inverse of the c.d.f. method not appropriate for obtaining the desired normal samples? Look up the Box-Muller method used to sample from the standard normal distribution. Describe the method and explain how is that we can reduce the problem of generating normal samples to the problem of generating samples of a distribution for which the inverse of the c.d.f. method works. Use the function 'rand' in Matlab together with the Box-Muller method, to generate 100 samples from the standard normal distribution (attach any code you use). Finally, create a qqplot (use Matlab's help for reference) of your samples. Is the qqplot obtained what you expected? Explain. How can you use samples from the standard normal distribution to obtain samples from the normal distribution with mean and variance 2 ? (3) Rejection sampling. Suppose you wanted to obtain samples from a distribution with density f . Imagine we know of a density h with the following properties: We know how to draw samples from the distribution with density h. For some large enough constant M > 0 we have f (x) M h(x) for every x R. We can obtain samples from the distribution with density f based on the rejection sampling algorithm: (a) Sample X 0 from the density h. Then, sample Y 0 uniformly on the interval [0, M h(X 0 )]. (b) If Y 0 f (X 0 ) then, set X = X 0 and return X. Else, go back to (a). 1 2 One can check that X thus obtained is indeed distributed according to f . In this way we can generate one sample from f . How can you use rejection sampling to simulate samples from the normal distribution, if you have access to samples from a bi-exponential distribution? Use your answer to the previous question to obtain 100 samples from the standard normal distribution and create a qqplot of your samples (attach any code you use). What method for generating normal samples is better, the Box-Muller method or the one you just described using rejection sampling? Explain. Remark: For a given f , many hs may satisfy the above conditions and for each such h many M s would work. Naturally, we look for hs and constants M that make the function M h as close as possible to the function f . This is so that in the rejection sampling algorithm we don't throw away too many samples; a lot of wasted samples means more computational time
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started