Lecture 8:Markov Chain Monte Carlo Methods (一) (马尔科夫蒙特卡罗方法) 张伟平 Monday 26th October,2009
Lecture 8: Markov Chain Monte Carlo Methods (ò) (ÍâÅÑAk¤ê{) ‹ï² Monday 26th October, 2009
Contents 1 Markov Chain Monte Carlo Methods y 1.1 Introduction..........·.。....······· 1.1.1 Integration problems in Bayesian inference...... 2 1.l.2 Markov Chain Monte Carlo Integration·.·..·· ¥ 1.1.3 arkov Chain.·.··.··.·········· b l.2 The Metropolis-Hastings Algorithm.·...·-······· 13 1.2.1 Metropolis-Hastings Sampler 14 1.2.2 The Metropolis Sampler................22 1.2.3 Random Walk Metropolis 23 1.2.4 The Independence Sampler 33 1.3 Single-component Metropolis Hastings Algorithms 37 l.4 Application:Logistic regression············· ...39 Previous Next First Last Back Forward 1
Contents 1 Markov Chain Monte Carlo Methods 1 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1.1 Integration problems in Bayesian inference . . . . . . 2 1.1.2 Markov Chain Monte Carlo Integration . . . . . . . 4 1.1.3 Markov Chain . . . . . . . . . . . . . . . . . . . . . 8 1.2 The Metropolis-Hastings Algorithm . . . . . . . . . . . . . . 13 1.2.1 Metropolis-Hastings Sampler . . . . . . . . . . . . . 14 1.2.2 The Metropolis Sampler . . . . . . . . . . . . . . . . 22 1.2.3 Random Walk Metropolis . . . . . . . . . . . . . . . 23 1.2.4 The Independence Sampler . . . . . . . . . . . . . . 33 1.3 Single-component Metropolis Hastings Algorithms . . . . . 37 1.4 Application: Logistic regression . . . . . . . . . . . . . . . . 39 Previous Next First Last Back Forward 1
Chapter 1 Markoy Chain Monte Carlo Methods 1.1 Introduction MCMC(Markov Chain Monte Carlo)方法的一般理论框架可以参看Metropo- 1 lis et al..(1953)以及Hastings(1970),以及其他各种介绍MCMC的专著.本 节我们介绍这种方法的基本思想和应用, 注意在前面介绍Monte Carlo方法估计积分 g(t)dt, 是把此积分表示成一个对某个概率密度f(t)下的期望.从而积分估计问题转化 成从目标概率密度(t)中产生随机样本。 Previous Next First Last Back Forward
Chapter 1 Markov Chain Monte Carlo Methods 1.1 Introduction MCMC(Markov Chain Monte Carlo) ê{òÑnÿµeå±Îw Metropolis et al. (1953)±9 Hastings (1970), ±9Ÿ¶à´0MCMC;Õ. !·Ç0˘´ê{ƒgé⁄A^. 5ø3c°0Monte Carloê{O»© Z A g(t)dt, ¥rd»©L´§òáÈ,áV«ó›f(t)eœ". l »©OØK=z §l8IV«ó›f(t)•) ëÅ. Previous Next First Last Back Forward 1
在MCMC方法中,首先建立一个马尔科夫链,使得f(t)为其平稳分布.则可 以运行此马尔科夫链充分长时间直至收敛到平稳分布,那么从目标分布f(t)中 产生随机样本,就是从达到平稳状态的马尔科夫链中产生其样本路径.我 们将介绍几种建立这样的马尔科夫链的方法:Metropolis算法,Metropolis- Hastings算法,以及Gibbs抽样方法.一个好的链应该具有快速混合(rapid mixing)性质一从任意位置出发很快达到平稳分布. 1.1.1 Integration problems in Bayesian inference Bayesian推断中的许多问题都是MCMC方法的应用.从Bayesian的观点来看, 模型中的观测变量和参数都是随机变量.因此,样本x=(1,·,xm)和参 数联合分布可以表示为 fx,e(r,)=fxle(x1,…,xn)π(0). Previous Next First Last Back Forward 2
3MCMCê{•, ƒkÔ·òáÍâÅÛ, ¶f(t)蟲©Ÿ. Kå ±$1dÍâÅÛø©ûmÜñ ¬Ò²©Ÿ, @ol8I©Ÿf(t)• )ëÅ, “¥là²GÍâÅÛ•)Ÿ¥ª. · ÇÚ0A´Ô·˘ÍâÅÛê{: Metropolisé{, MetropolisHastingsé{, ±9Gibbsƒê{. òá–ÛAT‰kØÑ·‹(rapid mixing)5ü—l?ø†ò—uÈØà²©Ÿ. 1.1.1 Integration problems in Bayesian inference Bayesian̉•NıØK—¥MCMCê{A^. lBayesian*:5w, .•*ˇC˛⁄ÎÍ—¥ëÅC˛. œd, x = (x1, · · · , xn)⁄Î ÍθÈ‹©Ÿå±L´è fx,θ(x, θ) = fx|θ(x1, · · · , xn)π(θ). Previous Next First Last Back Forward 2
从而根据Byes定理,可以通过样本x=(x1,·,xm)的信息对0的分布进行更 新: f(x)x(0) fol(0x)== ∫fr1e(x)π(0)d0 则在后验分布下,9()的期望为 Eg()=/g(0)folz(0)de= ∫g(0)fzle(x)r(e)dB ∫fxla(x)π(e)d0 此积分为值为样本x的函数.因此可以对g(0)进行推断.比如g()=时, 则Eg(z)=E可以作为的估计. 对此类问题我们考虑一般形式: Eg(Y)= Jg(t)(t)dt ∫r(t)dt 这里π()为一个密度或者似然.若为一密度,则此期望即为常见的期望定义: Eg(Y)=∫9()fy(t)d.若π为一似然,则需要一个正则化常数才可以成为密 度.在贝叶斯分析中,π()为一后验密度.当π()的正则化常数未知时,此积分 Previous Next First Last Back Forward 3
l ä‚Bayes½n, 屜Lx = (x1, · · · , xn)&EÈθ©Ÿ?1ç #: fθ|x(θ|x) == fx|θ(x)π(θ) R fx|θ(x)π(θ)dθ . K3©Ÿe, g(θ)œ"è Eg(θ|x) = Z g(θ)fθ|x(θ|x)dθ = R g(θ)fx|θ(x)π(θ)dθ R fx|θ(x)π(θ)dθ . d»©èäèxºÍ. œdå±Èg(θ)?1̉. 'Xg(θ) = θû, KEg(θ|x) = E[θ|x] å±äèθO. ÈdaØK·ÇƒòÑ/™: Eg(Y ) = R g(t)π(t)dt R π(t)dt . ˘pπ(·)èòá󛽈q,. eπèòó›, Kdœ"=è~Ñœ"½¬: Eg(Y ) = R g(t)fY (t)dt. eπèòq,, KIáòáKz~͂屧èó ›. 3ìd©¤•, π(·)èòó›. π(·) Kz~Íôû, d»© Previous Next First Last Back Forward 3