Metropolis-Hastings Markov Chain Monte Carlo Sampling
The
Metropolis-Hastings Markov Chain Monte Carlo Sampling algorithm can draw samples from any
probability distribution
P(x), requiring only thatdensity can be calculated at
x. The algorithm generatessetstates x
t which is
Markov chain because each state x
t depends only onprevious state x
t-1. The algorithm depends oncreation of
proposal density Q(x
t;x') which depends oncurrent state x
twhich can generatenew proposed sample x'. For example,proposal density could be
Gaussian function centred oncurrent state x
t
This proposal density would generate samples centred aroundcurrent statevariance σ
2I. So we drawnew proposal state from Q(x
t,x')then calculatevalue
where
islikelihood ratio betweenproposed sample x' andprevious sample x
t, and
isratio ofproposal densitytwo directions (from x
tx'
vice versa). Thisequal1 ifproposal densitysymmetric. Thennew state x
t+1chosen withrule
The Markov chainstarted fromrandom initial value x
0 andalgorithmrun forfew thousand iterations so that this initial state"forgotten". These samples, whichdiscarded,known as
burn-in. The algorithm works best ifproposal density matchesshape oftarget distribution P(x), butmost cases thisunknown. IfGaussian proposalusedvariance parameter σ
2 hasbe tuned duringburn-in period. Thisusually done by calculating
acceptance rate, which isfractionproposed samples thataccepted inwindow oflast N samples. Thisusually setbe around 60%. Ifproposal stepstoo smallchain will
mix slowly i.e.will move aroundspace slowlyconverge slowlyP(x). Ifproposal stepstoo largeacceptance rate will be very low becauseproposalslikelylandregionsmuch lower probability density so a
1 will be very small.