Metropolis-Hastings Algorithm

  1. Suppose that the number of children per household in the U.S. has the following distribution

x012345P(X=x)0.150.180.350.200.080.04

  1. Describe in detail how you could implement by hand a Metropolis-Hastings algorithm to simulate from this distribution, using a random walk to neighboring states as the proposal chain.
  2. Write a few lines of code to implement and run your algorithm, and summarize the approximate distribution. Does your algorithm seem to work?
  3. Specify the transition matrix for the M-H algorithm in the previous part.
  4. Find the stationary distribution of the M-H chain. Is it the target distribution?
  1. The standard double exponential distribution has a pdf which satisfies f(x)e|x|,<x<
  1. Describe in detail a Metropolis-Hastings algorithm for simulating from this distribution.
  2. Write a few lines of code to implement the algorithm and run it. Does the algorithm seem to produce values from the target distribution?