06.06.2013 Views

Theory of Statistics - George Mason University

Theory of Statistics - George Mason University

Theory of Statistics - George Mason University

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

664 0 Statistical Mathematics<br />

Generate x (k+1)<br />

d−1 conditionally on x (k+1)<br />

1 , x (k+1)<br />

2 , . . ., x (k)<br />

d ,<br />

Generate x (k+1)<br />

d conditionally on x (k+1)<br />

1 , x (k+1)<br />

2 , . . ., x (k+1)<br />

d−1 .<br />

3. If convergence has occurred, then<br />

3.a. deliver x = x (k+1) ;<br />

otherwise<br />

3.b. set k = k + 1, and go to step 2.<br />

Example 0.0.10 Gibbs Sampling to Generate Independent Normals<br />

Consider Xt+1 normal with a mean <strong>of</strong> Xt and a variance <strong>of</strong> σ 2 .<br />

We will generate an iid sample from a standard normal distribution; that<br />

is, a normal with a mean <strong>of</strong> 0 and a variance <strong>of</strong> 1. In this example, the target<br />

distribution is simpler than the proposal.<br />

We start with a x0, chosen arbitrarily.<br />

We take logs and cancel terms in the expression for r.<br />

The following simple Matlab statements generate the sample.<br />

x(1) = x0;<br />

while i < n<br />

i = i + 1;<br />

yip1 = yi + sigma*randn;<br />

lr2 = yi^2 - yip1^2;<br />

if lr2 > 0<br />

yi = yip1;<br />

else<br />

u = rand;<br />

if lr2 > log(u)*2<br />

yi = yip1;<br />

else<br />

yi = x(i-1);<br />

end<br />

end<br />

x(i) = yi;<br />

end<br />

plot (x)<br />

There are several variations <strong>of</strong> the basic Metropolis-Hastings algorithm.<br />

Two common related methods are Gibbs sampling and hit-and-run sampling.<br />

Those methods are particularly useful in multivariate simulation.<br />

Markov chain Monte Carlo has become one <strong>of</strong> the most important tools in<br />

statistics in recent years. Its applications pervade Bayesian analysis, as well<br />

as many Monte Carlo procedures in the frequentist approach to statistical<br />

analysis.<br />

Whenever a correlated sequence such as a Markov chain is used, variance<br />

estimation must be performed with some care. In the more common cases<br />

<strong>Theory</strong> <strong>of</strong> <strong>Statistics</strong> c○2000–2013 James E. Gentle

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!