University | Singapore University of Social Science (SUSS) |
Subject | ST2195 Programming For Data Science Report |
ST2195 Programming For Data Science Report: The Markov Chain Monte Carlo algorithm, in particular the Metropolis-Hastings algorithm
Part 1 In this part, you are asked to work with the Markov Chain Monte Carlo algorithm, in particular the Metropolis-Hastings algorithm. The aim is to simulate random numbers for the distribution with the probability density function given below
where x takes values in the real line and |x| denotes the absolute value of x. More specifically, you are asked to generate x0, x1, . . . , xN values and store them using the following version of the Metropolis-Hastings algorithm (also known as random walk Metropolis) that consists of the steps below:
Stuck with a lot of homework assignments and feeling stressed ? Take professional academic assistance & Get 100% Plagiarism free papers
Random walk Metropolis
Step 1 Set up an initial value x0 as well as a positive integer N and a positive real number s.
Step 2 Repeat the following procedure for i = 1, . . . , N :
• Simulate a random number x∗ from the Normal distribution with mean xi−1 and standard deviation s.
• Compute the ratio
• Generate a random number u from the uniform distribution between 0 and 1.
• If u < r (x∗, xi−1), set xi = x∗, else set xi = xi−1.
(a) Apply the random walk Metropolis algorithm using N = 10000 and s = 1. Use the generated samples (x1, . . . xN ) to construct a histogram and a kernel density plot in the same figure. Note that these provide estimates of f (x). Overlay a graph of f (x) on this figure to visualize the quality of these estimates. Also, report the sample mean and standard deviation of the generated samples (Note: these are also known as the Monte Carlo estimates of the mean and standard deviation respectively).
Practical tip: To avoid numerical errors, it is better to use the equivalent criterion log u < log r (x∗, xi−1) = log f (x∗) − log f (xi−1) instead of u < r (x∗, xi−1).
Buy Custom Answer of This Assessment & Raise Your Grades
Are you a Singapore University of Social Science (SUSS) student grappling with the ST2195 Coursework Project? Ease your academic journey with our expert Assignment Helper and specialized Case Study Writing Help. Pay for assistance and conquer the complexities of the Markov Chain Monte Carlo algorithm effortlessly.
Tags:-
- ELG101: Discovering Language Assignment, SUSS, Singapore: Speakers are creative users of the languages they speak. In our everyday interaction
- ELG101: Discovering Language Assignment, SUSS, Singapore: Demonstrate the articulation of the words in the above data set using the International Phonetic
- Principles of Project Management Individual Assignment, SUSS, Singapore: You are appointed a Project Manager in charge of organising and planning a project
- COR2223: Frontiers of Modern Computing Final Written Assignment, SMU, Singapore: Write a short story imagining a future scenario and how one or more of the modern computing technologies
- AC2101: Accounting Recognition and Measurement Assignment, NTU, Singapore: If NTU-C were to record the abovementioned transactions on 31 January, 28 February and 15 March 20×2
- BSE217: Motor Development, Control and Learning Assignment, SUSS, Singapore: Create a rating scale or categories of differentiation to rate the movement proficiencies of the individual
- BSE217: Motor Development, Control and Learning Assignment, SUSS, Singapore: Discuss the main theoretical foundations of Ecological Dynamics Theory
- NCO201: Learn To Learn, Learn For Life Tutor-Marked Assignment 2, SUSS, Singapore: Create a learning plan. Use this template to create your learning plan
- NCO201: Learn To Learn, Learn For Life Tutor-Marked Assignment 2, SUSS, Singapore: Self-reflection is a critical part of learning. By looking back at your process and analysing
- BPM301: LCC and Sustainable Design and Construction Assignment, SUSS, Singapore: A developer is building a new 3-storey sports complex on a 10-year leasehold land
UP TO 15 % DISCOUNT