0% found this document useful (0 votes)
23 views22 pages

Markov Chain Monte Carlo:: A Workhorse For Modern Scientific Computation

This document discusses Markov chain Monte Carlo (MCMC) methods, which are widely used for scientific computation. It provides examples of how MCMC can be applied to problems in fields such as physics, chemistry, astronomy, biology and other areas. The document also explains specific MCMC algorithms like the Gibbs sampler, Metropolis-Hastings algorithm and data augmentation for simulating complex probability distributions and performing statistical inference.

Uploaded by

Devansh Dwivedi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views22 pages

Markov Chain Monte Carlo:: A Workhorse For Modern Scientific Computation

This document discusses Markov chain Monte Carlo (MCMC) methods, which are widely used for scientific computation. It provides examples of how MCMC can be applied to problems in fields such as physics, chemistry, astronomy, biology and other areas. The document also explains specific MCMC algorithms like the Gibbs sampler, Metropolis-Hastings algorithm and data augmentation for simulating complex probability distributions and performing statistical inference.

Uploaded by

Devansh Dwivedi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 22

MARKOV CHAIN

MONTE CARLO:
A Workhorse for Modern
Scientific Computation

March 12, 2024 1


Introduction

March 12, 2024 2


Applications of Monte Carlo
Physics Sociology Economics

Chemistry Education Finance

Astronomy Psychology Management

Biology Arts Policy

Environment Linguistics Military

Engineering History Government

Traffic Medical Science Business


March 12, 2024 3
Monte Carlo 之应用
A Chinese version of the previous slide
物理 社会 经济
化学 教育 金融
天文 心理 管理
生物 人文 政策
环境 语言 军事
工程 历史 政府
交通 医学 商务

March 12, 2024 4
Monte Carlo Integration
 Suppose we want to compute

where f(x) is a probability density. If


we have samples x1,…,xn » f(x), we can estimate I by

March 12, 2024 5


Monte Carlo Optimization
 We want to maximize p(x)

0.0 0.1 0.2 0.3 0.4


 Simulate from

density
=1
f(x) / p(x).
-5 0 5

As  ! 1, the simulated x

draws will be more and

0.00 0.05 0.10 0.15


=2

density
more concentrated around
the maximizer of p(x) -5 0 5

8.0 e-09
=20 density

0.0 e+00

-5 0 5

March 12, 2024 6


Simulating from a Distribution
 What does it mean?
Suppose a random variable ( 随机变量 ) X can only take two values:

Simulating from the distribution of X means that we want a collection


of 0’s and 1’s:

such that about 25% of them are 0’s and about 75%of them are 1’s,
when n, the simulation size is large.

 The {xi, i = 1,…,n} don’t have to be independent

March 12, 2024 7


Simulating from a Complex Distribution

 Continuous variable X,
described by a density
function f(x)

 Complex:
 the form of f(x)
 the dimension of x

March 12, 2024 8


Markov Chain Monte Carlo

where {U(t), t=1,2,…} are identically and independently distributed.

 Under regularity conditions,

So We can treat {x(t), t= N0, …, N} as an approximate sample from


f(x), the stationary/limiting distribution.

March 12, 2024 9


Gibbs Sampler
 Target density:
 We know how to simulate form the conditional
distributions

 For the previous example,

N(,2)
Normal Distribution
“Bell Curve”

March 12, 2024 10


March 12, 2024 11
Statistical Inference
 Point Estimator:

 Variance Estimator:

 Interval Estimator:

March 12, 2024 12


Gibbs Sampler (k steps)
 Select an initial value (x1(0), x2(0) ,…, xk(0)).
 For t = 0,1,2, …, N
 Step 1: Draw x1(t+1) from f(x1|x2(t), x3(t),…, xk(t))
 Step 2: Draw x2(t+1) from f(x2|x1(t+1), x3(t),…, xk(t))

 Step K:Draw xk(t+1) from f(xk|x1(t+1), x2(t+1),…, xk-1(t+1))
 Output {(x1(t), x2(t),…, xk(t) ): t= 1,2,…,N}
 Discard the first N0 draws
Use {(x1(t), x2(t),…, xk(t) ): t= N0+1,2,…,N} as (approximate) samples from
f(x1, x2,…, xk).

March 12, 2024 13


Data Augmentation
 We want to simulate from

But this is just the marginal distribution of

0.6
So once we have simulations:

0.5
{(x(t), y(t): t= 1,2,…,N)},
0.4

we also obtain draws:


density

0.3

{x(t): t= 1,2,…,N)}
0.2
0.1
0.0

March 12, 2024


0 2 4 6
14
x
A More Complicated Example

March 12, 2024 15


Metropolis-Hastings algorithm
 Simulate from an approximate distribution q(z1|z2), then
 Step 0: Select z(0);
Now for t = 1,2,…,N, repeat
 Step 1: draw z1 from q(z1|z2=z(t))
 Step 2: Calculate

Accept
 Step 3: set
reject

 Discard the first N0 draws

March 12, 2024 16


M-H Algorithm: An Intuitive Explanation

Assume , then

March 12, 2024 17


M-H: A Terrible Implementation

We choose q(z|z2)=q(z)=(x-4)(y-4)

 Step 1: draw x » N(4,1), y » N(4,1);


Dnote z1=(x,y)

 Step 2: Calculate

 Step 3: draw u » U[0,1]


Let

March 12, 2024 18


Why is it so bad?

March 12, 2024 19


M-H: A Better Implementation

Starting from some arbitrary (x(0),y(0))

 Step 1: draw x » N(x(t),1), y » N(y(t),1)


“random walk”

 Step 2: dnote z1=(x,y), calculate

 Step 3: draw u » U[0,1]


Let

March 12, 2024 20


Much Improved!

March 12, 2024 21


Further Discussion
 How large should N0 and N be?

Not an easy problem!


 Key difficulty:
multiple modes in unknown area

 We would like to know all (major) modes, as well as their surrounding mass.
Not just the global mode
We need “automatic, Hill-climbing” algorithms.

) The Expectation/Maximization (EM) Algorithm, which can be viewed as a deterministic


version of Gibbs Sampler.

March 12, 2024 22

You might also like