# The term paper: Problem 2.

Updated April 3rd; today's version of the Schweder compendium now has exercise 13 back to number "13". *In any case, the clickable link in the problem set leads to the appropriate problem*

There has been a question on the interpretation of problem 2, which is exercise 13 in the April 3 version of Schweder's compendium.

**First part, **the result concerning the posterior distribution is found in the problem text -- and it will give you the *g* function in Schweder p. 35, with the form as in the solution.

So the answer is given, but you are supposed to show this in sufficient detail. (No numerics here.)

**Second part,** the numerical exercise bit, the MCMC is outlined in Scwheder pp. 35--36 (p. 35 in the old version of the compendium):

- You already have
*g*(modulo a constant), and*q*is given in the solution (where φ is the standard Gaussian density function) together with ρ - Then you

(1) Start at some arbitrary point*s*in the state space; put*T*._{1}=s

(2) When you have drawn*T*, draw_{n}*U*as described on p. 36 (p. 35). You can even use a spreadsheet_{n}

(hint: you only need to draw*one*standard normal variable, add*T*-- and what would you do to keep it positive? What is done in the solution?)_{n}

(3) The next state is then given by formula (14) -- read the*g(U*_{n}*)>g(T*_{n}*)*criterion in the subsequent paragraph.

(4) Run this recursively for a sufficient number*n*of iterations. Store*T*._{N}

(5) Repeat (1) -- (4) a sufficient number of times. For each repetition, store*T*._{N}

(6) Plot the distribution of the*T*against the gamma. A qq-plot is preferred, but for the purposes of the term paper, a histogram together with the would also do._{N}

(If in (5) you are using a spreadsheet, then just use one column for each repetition (1) -- (4), and copy formulas (just make sure you get independent randomness).)