Question: Problem 2.7 A generic MetropolisHastings (MH) algorithm for continuous or discrete distributions is as follows. Step 0: Initialize X0 = x0 Step 1: At iteration

Problem 2.7 A generic MetropolisHastings (MH) algorithm for continuous or discrete distributions is as follows.

Step 0: Initialize X0 = x0

Step 1: At iteration n, generate a proposal x Q(x | xn1). The proposal distribution Q should have the same support as the target distribution, .

Step 2: Calculate the acceptance probability

= min { 1, ((x*) /(xn1)) * (Q(xn1 | x* ) /Q(x | xn1)) }

Step 3: Generate u U(0, 1). If u < , set Xn = x , otherwise set Xn = xn1.

Step 4: Put n n + 1 and repeat from Step 1. \

Repeat a large number, B + N, of times where B = burin. Then the first B values are discarded.

(a) How would you set up MetropolisHastings (MH) algorithm to generate samples from a Poisson distribution, j = (j e )/ j! for j = 0, 1, 2, . . . . In particular, specify an appropriate transition matrix Q and the acceptance probability . Hint: The chain should have support on the non-negative integers and be simple to generate. In the Beta example, I used an independent MH algorithm. For this problem, consider using a random walk MH and where the Q( | ) ratio in Step 2 is always 1.

(b) Write a program to generate observations from a Poisson based on your pseudo-code and then run it. Display your program with details and include the results of a run.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!