<s>
In	O
statistics	O
and	O
statistical	O
physics	O
,	O
the	O
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
algorithm	I-Algorithm
is	O
a	O
Markov	B-General_Concept
chain	I-General_Concept
Monte	I-General_Concept
Carlo	I-General_Concept
(	O
MCMC	O
)	O
method	O
for	O
obtaining	O
a	O
sequence	O
of	O
random	B-Algorithm
samples	I-Algorithm
from	O
a	O
probability	O
distribution	O
from	O
which	O
direct	O
sampling	O
is	O
difficult	O
.	O
</s>
<s>
to	O
generate	O
a	O
histogram	B-Algorithm
)	O
or	O
to	O
compute	B-Algorithm
an	I-Algorithm
integral	I-Algorithm
(	O
e.g.	O
</s>
<s>
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
and	O
other	O
MCMC	O
algorithms	O
are	O
generally	O
used	O
for	O
sampling	O
from	O
multi-dimensional	O
distributions	O
,	O
especially	O
when	O
the	O
number	O
of	O
dimensions	O
is	O
high	O
.	O
</s>
<s>
adaptive	O
rejection	B-Algorithm
sampling	I-Algorithm
)	O
that	O
can	O
directly	O
return	O
independent	O
samples	O
from	O
the	O
distribution	O
,	O
and	O
these	O
are	O
free	O
from	O
the	O
problem	O
of	O
autocorrelated	O
samples	O
that	O
is	O
inherent	O
in	O
MCMC	B-General_Concept
methods	I-General_Concept
.	O
</s>
<s>
The	O
algorithm	O
is	O
named	O
in	O
part	O
for	O
Nicholas	O
Metropolis	O
,	O
the	O
first	O
coauthor	O
of	O
a	O
1953	O
paper	O
,	O
entitled	O
Equation	O
of	O
State	O
Calculations	O
by	O
Fast	O
Computing	O
Machines	O
,	O
with	O
Arianna	B-Algorithm
W	I-Algorithm
.	I-Algorithm
Rosenbluth	I-Algorithm
,	O
Marshall	O
Rosenbluth	O
,	O
Augusta	O
H	O
.	O
Teller	O
and	O
Edward	O
Teller	O
.	O
</s>
<s>
For	O
many	O
years	O
the	O
algorithm	O
was	O
known	O
simply	O
as	O
the	O
Metropolis	B-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
The	O
generalized	O
method	O
was	O
eventually	O
identified	O
by	O
both	O
names	O
,	O
although	O
the	O
first	O
use	O
of	O
the	O
term	O
"	O
Metropolis-Hastings	B-Algorithm
algorithm	I-Algorithm
"	O
is	O
unclear	O
;	O
it	O
may	O
have	O
first	O
appeared	O
in	O
a	O
1995	O
review	O
by	O
Chib	O
and	O
Greenberg	O
.	O
</s>
<s>
Some	O
controversy	O
exists	O
with	O
regard	O
to	O
credit	O
for	O
development	O
of	O
the	O
Metropolis	B-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
Metropolis	O
,	O
who	O
was	O
familiar	O
with	O
the	O
computational	O
aspects	O
of	O
the	O
method	O
,	O
had	O
coined	O
the	O
term	O
"	O
Monte	O
Carlo	O
"	O
in	O
an	O
earlier	O
article	O
with	O
Stanisław	O
Ulam	O
,	O
and	O
led	O
the	O
group	O
in	O
the	O
Theoretical	O
Division	O
that	O
designed	O
and	O
built	O
the	O
MANIAC	B-Device
I	I-Device
computer	O
used	O
in	O
the	O
experiments	O
in	O
1952	O
.	O
</s>
<s>
Arianna	B-Algorithm
Rosenbluth	I-Algorithm
recounted	O
(	O
to	O
Gubernatis	O
in	O
2003	O
)	O
that	O
Augusta	O
Teller	O
started	O
the	O
computer	O
work	O
,	O
but	O
that	O
Arianna	O
herself	O
took	O
it	O
over	O
and	O
wrote	O
the	O
code	O
from	O
scratch	O
.	O
</s>
<s>
The	O
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
algorithm	I-Algorithm
can	O
draw	O
samples	O
from	O
any	O
probability	O
distribution	O
with	O
probability	O
density	O
,	O
provided	O
that	O
we	O
know	O
a	O
function	O
proportional	O
to	O
the	O
density	O
and	O
the	O
values	O
of	O
can	O
be	O
calculated	O
.	O
</s>
<s>
The	O
requirement	O
that	O
must	O
only	O
be	O
proportional	O
to	O
the	O
density	O
,	O
rather	O
than	O
exactly	O
equal	O
to	O
it	O
,	O
makes	O
the	O
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
algorithm	I-Algorithm
particularly	O
useful	O
,	O
because	O
calculating	O
the	O
necessary	O
normalization	O
factor	O
is	O
often	O
extremely	O
difficult	O
in	O
practice	O
.	O
</s>
<s>
The	O
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
algorithm	I-Algorithm
generates	O
a	O
sequence	O
of	O
sample	O
values	O
in	O
such	O
a	O
way	O
that	O
,	O
as	O
more	O
and	O
more	O
sample	O
values	O
are	O
produced	O
,	O
the	O
distribution	O
of	O
values	O
more	O
closely	O
approximates	O
the	O
desired	O
distribution	O
.	O
</s>
<s>
For	O
the	O
purpose	O
of	O
illustration	O
,	O
the	O
Metropolis	B-Algorithm
algorithm	I-Algorithm
,	O
a	O
special	O
case	O
of	O
the	O
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
algorithm	I-Algorithm
where	O
the	O
proposal	O
function	O
is	O
symmetric	O
,	O
is	O
described	O
below	O
.	O
</s>
<s>
Compared	O
with	O
an	O
algorithm	O
like	O
adaptive	O
rejection	B-Algorithm
sampling	I-Algorithm
that	O
directly	O
generates	O
independent	O
samples	O
from	O
a	O
distribution	O
,	O
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
and	O
other	O
MCMC	O
algorithms	O
have	O
a	O
number	O
of	O
disadvantages	O
:	O
</s>
<s>
On	O
the	O
other	O
hand	O
,	O
most	O
simple	O
rejection	B-Algorithm
sampling	I-Algorithm
methods	O
suffer	O
from	O
the	O
"	O
curse	B-Algorithm
of	I-Algorithm
dimensionality	I-Algorithm
"	O
,	O
where	O
the	O
probability	O
of	O
rejection	O
increases	O
exponentially	O
as	O
a	O
function	O
of	O
the	O
number	O
of	O
dimensions	O
.	O
</s>
<s>
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
,	O
along	O
with	O
other	O
MCMC	B-General_Concept
methods	I-General_Concept
,	O
do	O
not	O
have	O
this	O
problem	O
to	O
such	O
a	O
degree	O
,	O
and	O
thus	O
are	O
often	O
the	O
only	O
solutions	O
available	O
when	O
the	O
number	O
of	O
dimensions	O
of	O
the	O
distribution	O
to	O
be	O
sampled	O
is	O
high	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
MCMC	B-General_Concept
methods	I-General_Concept
are	O
often	O
the	O
methods	O
of	O
choice	O
for	O
producing	O
samples	O
from	O
hierarchical	O
Bayesian	O
models	O
and	O
other	O
high-dimensional	O
statistical	O
models	O
used	O
nowadays	O
in	O
many	O
disciplines	O
.	O
</s>
<s>
In	O
multivariate	O
distributions	O
,	O
the	O
classic	O
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
algorithm	I-Algorithm
as	O
described	O
above	O
involves	O
choosing	O
a	O
new	O
multi-dimensional	O
sample	O
point	O
.	O
</s>
<s>
An	O
alternative	O
approach	O
that	O
often	O
works	O
better	O
in	O
such	O
situations	O
,	O
known	O
as	O
Gibbs	B-Algorithm
sampling	I-Algorithm
,	O
involves	O
choosing	O
a	O
new	O
sample	O
for	O
each	O
dimension	O
separately	O
from	O
the	O
others	O
,	O
rather	O
than	O
choosing	O
a	O
sample	O
for	O
all	O
dimensions	O
at	O
once	O
.	O
</s>
<s>
Various	O
algorithms	O
can	O
be	O
used	O
to	O
choose	O
these	O
individual	O
samples	O
,	O
depending	O
on	O
the	O
exact	O
form	O
of	O
the	O
multivariate	O
distribution	O
:	O
some	O
possibilities	O
are	O
the	O
adaptive	O
rejection	B-Algorithm
sampling	I-Algorithm
methods	O
,	O
the	O
adaptive	O
rejection	O
Metropolis	B-Algorithm
sampling	I-Algorithm
algorithm	O
,	O
a	O
simple	O
one-dimensional	O
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
step	O
,	O
or	O
slice	B-Algorithm
sampling	I-Algorithm
.	O
</s>
<s>
The	O
purpose	O
of	O
the	O
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
algorithm	I-Algorithm
is	O
to	O
generate	O
a	O
collection	O
of	O
states	O
according	O
to	O
a	O
desired	O
distribution	O
.	O
</s>
<s>
The	O
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
algorithm	I-Algorithm
involves	O
designing	O
a	O
Markov	O
process	O
(	O
by	O
constructing	O
transition	O
probabilities	O
)	O
that	O
fulfills	O
the	O
two	O
above	O
conditions	O
,	O
such	O
that	O
its	O
stationary	O
distribution	O
is	O
chosen	O
to	O
be	O
.	O
</s>
<s>
The	O
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
algorithm	I-Algorithm
can	O
thus	O
be	O
written	O
as	O
follows	O
:	O
</s>
<s>
A	O
common	O
use	O
of	O
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
algorithm	I-Algorithm
is	O
to	O
compute	B-Algorithm
an	I-Algorithm
integral	I-Algorithm
.	O
</s>
<s>
The	O
Metropolis	B-Algorithm
–	I-Algorithm
Hastings	I-Algorithm
algorithm	I-Algorithm
can	O
be	O
used	O
here	O
to	O
sample	O
(	O
rare	O
)	O
states	O
more	O
likely	O
and	O
thus	O
increase	O
the	O
number	O
of	O
samples	O
used	O
to	O
estimate	O
on	O
the	O
tails	O
.	O
</s>
<s>
These	O
guidelines	O
can	O
work	O
well	O
when	O
sampling	O
from	O
sufficiently	O
regular	O
Bayesian	O
posteriors	O
as	O
they	O
often	O
follow	O
a	O
multivariate	O
normal	O
distribution	O
as	O
can	O
be	O
established	O
using	O
the	O
Bernstein-von	B-General_Concept
Mises	I-General_Concept
theorem	I-General_Concept
.	O
</s>
