Q50. Metropolis–Hastings with a Cauchy prior

[8 marks]

A parameter \theta\in\mathbb R has posterior density \pi(\theta\mid{\boldsymbol{x}})\propto L(\theta;{\boldsymbol{x}})p(\theta). Assume the likelihood and prior are positive at the current and proposed states. From the current state \theta, propose \theta'=\theta+\varepsilon,\qquad\varepsilon\sim N(0,s^2), where s^2>0 is fixed.

(a) Write the general Metropolis–Hastings acceptance probability, including the proposal densities. [2 marks]

(b) Simplify it for this proposal. State and justify the precise equality that permits cancellation of the proposal densities. [2 marks]

(c) Suppose the prior is standard Cauchy: p(\theta)=\frac1{\pi(1+\theta^2)}. Write the log of the untruncated acceptance ratio explicitly in terms of the log-likelihood and the current and proposed states. [2 marks]

(d) Explain the numerical advantage of using logarithms, and state how to implement the accept/reject decision using U\sim\operatorname{Uniform}(0,1) without exponentiating the log ratio. [2 marks]

Definitions. Let \ell(\theta)=\log L(\theta;{\boldsymbol{x}}) and let q(\theta'\mid\theta) be the proposal density. The untruncated MH ratio is r; the acceptance probability is \min(1,r). The standard Cauchy prior has density 1/\{\pi(1+\theta^2)\} on \mathbb R. The fixed Normal random walk uses variance s^2>0, and likelihood and prior are positive at both states.

(a) General acceptance probability. Let q(\theta'\mid\theta) denote the proposal density. The general rule is \boxed{ A(\theta,\theta') =\min\left\{1, \frac{\pi(\theta'\mid{\boldsymbol{x}})q(\theta\mid\theta')} {\pi(\theta\mid{\boldsymbol{x}})q(\theta'\mid\theta)}\right\}. } Substituting the posterior kernel, the untruncated ratio is r(\theta,\theta') =\frac{L(\theta';{\boldsymbol{x}})p(\theta')q(\theta\mid\theta')} {L(\theta;{\boldsymbol{x}})p(\theta)q(\theta'\mid\theta)}. The posterior’s unknown normalising constant cancels between numerator and denominator.

(b) Symmetric Normal random walk. For the given proposal, q(\theta'\mid\theta) =\frac1{\sqrt{2\pi s^2}} \exp\left\{-\frac{(\theta'-\theta)^2}{2s^2}\right\}. Since (\theta'-\theta)^2=(\theta-\theta')^2 and the same fixed s^2 is used in both directions, \boxed{q(\theta'\mid\theta)=q(\theta\mid\theta').} It is this equality of the forward and reverse density values that permits cancellation. The proposal distributions centred at \theta and \theta' are not generally identical distributions. Thus \boxed{ A(\theta,\theta') =\min\left\{1,\frac{L(\theta';{\boldsymbol{x}})p(\theta')} {L(\theta;{\boldsymbol{x}})p(\theta)}\right\}. }

(c) Log of the untruncated ratio under the Cauchy prior. Write \ell(\theta)=\log L(\theta;{\boldsymbol{x}}). Since \frac{p(\theta')}{p(\theta)} =\frac{1+\theta^2}{1+(\theta')^2}, we obtain \boxed{ \log r(\theta,\theta') =\ell(\theta')-\ell(\theta) +\log(1+\theta^2)-\log\{1+(\theta')^2\}. } This quantity may be positive. It is not yet \log A(\theta,\theta'); the log acceptance probability is \min\{0,\log r(\theta,\theta')\}.

(d) Stable accept/reject decision. Likelihoods can be products of many small numbers, causing underflow; ratios of very large or very small values can also overflow or lose precision. Working directly with log-likelihoods converts products into sums and ratios into differences, avoiding the need to form the raw likelihoods or acceptance ratio.

Let \Delta=\ell(\theta')-\ell(\theta) +\log(1+\theta^2)-\log\{1+(\theta')^2\}. Draw U\sim\operatorname{Uniform}(0,1) independently of the proposal. Since logarithms are increasing, U\le\min\{1,e^\Delta\} \quad\Longleftrightarrow\quad \boxed{\log U\le\min\{0,\Delta\}.} If the inequality holds, accept \theta' as the next state; otherwise retain \theta. No exponentiation of \Delta is required. Equivalently, accept every proposal with \Delta\ge0, and otherwise accept when \log U\le\Delta.