[SOLVED] MATH4/68091 Statistical Computing Coursework 1

$25

File Name: MATH4/68091_Statistical_Computing_Coursework_1.zip
File Size: 433.32 KB

Category:
5/5 - (1 vote)

MATH4/68091 Statistical Computing Coursework 1

Please submit via Blackboard. Late submissions may be penalized according to the Department’s procedures. Note also that I do not have the authority to grant extensions to the deadline.

By submitting the coursework you declare that you are its sole author. In particular, you should not collaborate with your peers.

Your submitted solutions should all be in one pdf document. You are strongly advised to produce this document using LATEX, but you will not be penalised if you use other software. Do not include screenshots of the R console or graphics. R commands should be shown using a typewriter type font. In LATEX this can be done with:

begin{verbatim} R code

end{verbatim}

Plots should be saved to les (one per graphics) and included in the document with suitable LATEX commands. Examples of how to save a plot to a le are given in my guide Rhints.pdf , available on Blackboard and on my web page. Users of other text editing software should use the facilities provided by it.

For each part of the questions you should provide explanations as to how you completed what is required, show your working and also comment on computational and/or graphical results, where applicable. Aim to be concise. For computational questions, show your code.

The total marks for this paper are 20. Within each question, the individual parts have equal weights.

  1. (8 marks)

    The standard double exponential distribution (a.k.a. Laplace distribution) has pdf

    1

    2

    f (x) = image exp −|x|, for −∞ < x < .

    1. Find the cdf of the standard double exponential distribution.

    2. Describe in detail the steps of the inverse PIT (inverse cdf) method to obtain a random sample of size n from f (x).

    3. Write an R function implementing your procedure from part (b) for generating random samples from f (x).

    4. Run your function from part (c) to generate a random sample of size n = 5000 from f (x). Construct a histogram of the generated data, superimpose the pdf f (x) and comment on the goodness-of- t.

  2. (12 marks)

    Suppose that we want to simulate random data from the standard Normal distribution, N(0,1), whose pdf is given by

    1

    f (x) = 2π e

    x2/2

    , for −∞ < x < .

    It is proposed to develop a rejection sampling algorithm, where the proposal distribution is the standard double exponential distribution from Q1 with pdf

    1. De ne the constant K by

      1

      g(x) = image e

      2

      −|x|

      , for −∞ < x < .

      K = sup f (x) .

      r

      x g(x)

      Show that K = 2e .

      π

    2. Produce on the same plot graphs of the functions f (x) and Kg(x) using the value of K determined in part (a).

    3. Describe a rejection sampling algorithm for sampling from N(0,1), which uses as proposal distri- bution the standard double exponential distribution.

    4. Theoretically, how e cient is your rejection sampling algorithm described in part (c)?

    5. Write an R function which implements the algorithm you developed in part (c). It should return a random sample from N(0,1) of size speci ed by the user. Your function should provide an empirical estimate of its e ciency, for example by printing it.

      Note: For simulation from the standard double exponential distribution you can use your function from Q1. Alternatively, you can nd a suitable function in a CRAN package.

    6. Run your function to generate a random sample of size n = 5000 from the standard Normal distribution. Graphically explore whether your data is consistent with being sampled from a standard Normal distribution.

Note: Don’t go over the top here a single plot accompanied with suitable interpretation is su cient for full marks. And suitable interpretation can be a single sentence, especially when the answer is a rmative. Optionally, feel free to provide additional plot(s) (with interpretation) and maybe results of a test. This is completely risk-free, in that these will not a ect your mark but potentially will inform me about concepts for discussion.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] MATH4/68091 Statistical Computing Coursework 1
$25