ST303 Stochastic Simulation Coursework 1 2023
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
ST303 Stochastic Simulation Coursework 1 2023
1 Guidelines
1.1 Submission
Your coursework must be submitted by
Monday 3rd April 2023, 12pm (UK time).
· All consequences regarding late submission can be found on the School’s website
https://info.lse.ac.uk/Staff/Divisions/Academic-Registrars-Division/ Teaching-Quality-Assurance-and-Review-Office/Assets/Documents/Calendar/ GeneralAcademicRegulations .pdf
Note in particular: Five marks (out of 100) will be deducted for coursework submitted within 24 hours of the deadline and a further five marks will be deducted for each subsequent 24-hour period until the coursework is submitted. After five working days, coursework will only be accepted with the permission of the Chair of the Sub-Board of Examiners.
· Please submit all your files via Moodle. The Moodle submission portal is available
on the ST303 Moodle page.
· Please submit the following files:
– One zip-file that has the following name: If your candidate number is 12345, then name your zip-file CW1 CN12345.zip.
This zip-file should contain the following files:
* One markdown file, i.e., an .Rmd file, that the examiners can run, that contains a report answering all questions and the R code used to derive the answers. Write your code with necessary comments.
Use your candidate number as file name, e.g., CW1 CN12345code.Rmd.
* Your markdown file saved as a pdf-file (e.g., using the “Knit to PDF” in Rstudio). Only pdf file is acceptable for marking.
Use your candidate number as file name, e.g., CW1 CN12345report.pdf.
· Please write your report using LATEX. Write your code using R (Rstudio helps). Writing
mathematics by hand is unacceptable and will cost you a lot of marks.
· Please make sure that you restart R and run all chunks in the markdown file with a new
kernel exactly once before saving it as a pdf-file and submitting the files.
· The content of your work must remain anonymous, so do not write your name on anything.
Instead, you must identify your work with your Examination Candidate Number. You can check your candidate number on ‘LSE for You’ .
1.2 Academic integrity
· This is an individual project. When you submit the coursework via Moodle, you must
accept an Academic Integrity statement.
You are required to read the information on plagiarism on the following website:
https://info.lse.ac.uk/Staff/Divisions/Academic-Registrars-Division/ Teaching-Quality-Assurance-and-Review-Office/Assets/Documents/Calendar/ RegulationsAssessmentOffences-Plagiarism .pdf
Note in particular the first paragraph on this website:
“All work for classes and seminars (which could include, for example, written assignments, group work, presentations, and any other work, including computer programs) must be the student’s own work. Direct quotations from other work must be placed properly within quotation marks or indented and must be cited fully. All paraphrased material must be clearly acknowledged. Infringing this requirement, whether deliberately or not, or passing off the work of others as the student’s own work, whether deliberately or not, is plagiarism.”
· Note that all reports and codes will be submitted to Turnitin for textual similarity
review and the detection of plagiarism.
· This is an open book assessment and you are allowed to use any material made available on
Moodle for ST303 and any academic literature as long as you cite the material that you use fully.
· You are NOT permitted to: consult any online forum about the content of the assessment;
allow any other person to edit or proof read your work; submit any ideas or phrasing that are not your own (without appropriate citation).
· If you discuss the coursework with other students, your report must include an acknowledge-
ment section, which should include the other students’ candidate numbers and the questions you helped each other with.
· The examiners may conduct vivas to check that you were the author of the submitted files.
1.3 Specific guidelines on report
· The coursework consists of three problems. Your answers to all three problems will count
towards the final mark.
· Write a report (in the form of a R markdown file) and not just a question-answer style exercise
set solution to answer the questions. Your report should contain all mathematical derivations, figures, tables, calculations, codes, discussion, etc. Use complete sentences throughout. Give detailed arguments to explain your ideas and carefully justify your answers to show you understood the material.
· Your figures should be well formatted, with good axis labelling and appropriate titles. A
clear illustration of numerical solutions is an essential marking criterion.
· Some questions can be solved with multiple approaches. Bonus will be given if (1) pros and
cons of different approaches are compared, or (2) an effort has been made to improve the algorithm efficiency via better implementations or analytical formulas.
· Please only provide one markdown file and one pdf-file. Separate answers to the different
questions clearly in this report.
· You have to write your own R code and you must not use code from any other sources
(libraries, books, internet etc.) - the only exception to this rule is that you are allowed to use in-built R functions and the R code that is available on the ST303 Moodle page.
· Your submitted markdown file should run completely without any error message.
· In particular, note that your markdown file should NOT ask the user to enter variables needed
for the computation. Choose reasonable default parameters yourself and make clear in your report what the meaning and the names of the variables are.
· Add appropriate comments to your code to explain what your code is doing.
· Page limit: Use concise writing throughout. The pdf-version of your markdown file must
not exceed 25 A4 pages (using the standard settings within the markdown file).
1.4 Marking criterion
The coursework will be marked in line with the departmental assessment criteria which are available in the undergraduate handbook on p.17 which is available here:
https://www.lse.ac.uk/Statistics/Assets/Documents/
BSc-Department-of-Statistics-Handbook-2021-22 .pdf
1.5 Questions about the coursework
If you find that you have a question which is one where you would normally put your hand up (during a sit-down exam) and ask the invigilator for clarification, please post the question on the Q&A session in the Moodle forum. Your question will be considered by the person who set the coursework as soon as possible. Do NOT email the convenor directly.
2 Description of coursework
If you use a random number generator for any of the problems below, seed the generator so that the results are reproducible.
Justify your simulation procedure with necessary mathematical derivations, comparison against theoretical values, and proper visualisations.
Problem 1. Consider the discrete random variable N that can only take even values and its distribution is given by
2λ2k
P(N = 2k) = (eλ + e −λ )(2k)! , k = 0, 1, 2, . . .
(1) Set out a procedure to generate one simulation of the random variable N . [15 points]
(2) Use your procedure to approximate the mean and variance of N, and compare them to some reference values computed by other methods . [10 points]
Hint: To obtain a reference value, you may first compute the moment generating func- tion of N by using the series expression of a suitable hyperbolic function (see https: // en. wikipedia. org/ wiki/Hyperbolic_ functions) .
Problem 2. (1) Suppose that you can generate samples from the density g(x), x > 0 . Explain how would you generate a random variable with density
g(exe), x > R.
[5 points].
Hint: you may consider a composition method.
(2) Let α > 0 . Set out a procedure to generate samples from the density
2^α exe
[10 points]
(3) Consider a random variable with the density e−x4 , x > R.
Set out a procedure to simulate this random variable using an acceptance-rejection method with the density in Problem 2(2) as envelope . Report the acceptance rate . [15 points]
(4) Suggest an alternative method to generate from the density in Problem 2(3) without using acceptance-rejection. [10 points]
Hint: consider combining the trick in Problem 2(1) and the inverse transform method.
Problem 3. We consider applying a randomised algorithm to isolate the first element of a vector from the remaining elements . For each integer n < 2, we denote by Zn = (Zi) a sorted vector of real numbers such that Zi < Zj for all i < j . The algorithm goes as follows:
· Fix an initial vector Zn = (Zi) of length n and a parameter α > 0 . Set Z(0) = Zn .
· For the k -th iteration (with k > N), take the current vector Z(k − 1) (note that Z(k − 1) = (Zi) with some m ● n), and randomly split it into 2 vectors, where the probability
p(Zi, Zi+1eZ(k − 1)) of the split occurring on the interval (Zi, Zi+1) given Z(k − 1) is propor- tionally to (Zi+1 _ Zi)α , i. e .,
p(Zi, Zi+1eZ(k − 1)) = , i = 1, . . . , m _ 1.
Set Z(k) as the vector containing Z1, and discard the other vector.
· If the vector Z(k) only contains Z1, the algorithm terminates at this iteration. Otherwise, we proceed to the next iteration with the vector Z(k) .
For any given initial vector Zn, denote by H e Zn the number of splits that the algorithm takes to isolate Z1, i. e ., the number of iterations for the algorithm to terminate .
(1) Fix α = 1, n < 2, and the initial vector Zn = (Zi) with Zi = . Set out a procedure to estimate the distribution of H e Zn . [10 points]
(2) Fix α = 1 . Use your procedure to estimate E[H e Zn] and Var[H e Zn] for different integers n < 2, where for each n, the initial vector Zn is defined as in Problem 3(1) . Comment on your results . [10 points]
(3) For each s > 0 and integer n < 2, define the initial vector Zn,s = (Zi) with Zi = ╱ ←s . Extend the simulation procedure to allow for these initial vectors Zn,s and general α > 0 in the splitting probability p .
Fix a large n, and use your procedure to estimate E[H e Zn,s] and Var[H e Zn,s] for different s > 0 and α > 0 . Comment on your results . [15 points]
2023-03-20