Skip to main content
Md Abul Hayat
Graduate Assistant
Spring 2018
04/06/2018
Sampling Techniques and Their Uses
Contents
1. Motivation
2. Techniques
• UoU
• Rejection Sampling
• Metropolis-Hestings
• Gibbs sampling
3. Applications
Usefulness
• AF447, a flight from Rio de Janeiro, Brazil to Paris, France crashed on 1 June 2009.
• All 228 people died.
• Brazil Navy and French BEA searched the wreckage for one year, but failed.
• In July 2010, the U.S.-based search consultancy Metron, Inc. had been engaged to draw up a
probability map of where to focus the search, based on prior probabilities from flight data and
local condition reports, combined with the results from the previous searches.
• It was described as "classic" Bayesian search methods, an approach that had previously been
successful in the search for the submarine USS Scorpion and SS Central America.
• July 2011, full report was published and belongings of the passengers were returned.
Universality of Uniform
Plug in a RV to it’s CDF. We get a uniform RV.
Alternative Statement
Plug in a uniform RV to a ICDF. We get a RV with that CDF
Universality of Uniform : Intuition
Universality of Uniform : Requirements
• To sample from a RV, we need to know the ICDF of the RV
• We need samples from uniform distribution.
• This is why all programming languages have a uniform sample generator.
Problems
• We do not always have a closed form of CDF and ICDF.
• Gets complicated for multivariate case.
Rejection Sampling
• We desire samples from
• We are able to draw samples from , and we know a value c such that cQ∗(x) > P∗(x) for all x.
• A point (x; u) is generated at random under the curve
• If this point also lies below , then it is accepted.
• Otherwise we reject the sample.
Target density P(x)
Proposal density Q(x)
Rejection Sampling : Algorithm
1. Get a proposal density cQ* that covers target density P*
2. Draw a sample x𝑖 from Q*
3. Draw a sample ui from uniform distribution of [0, 1]
4. Reject sample X𝑖, if ui > P* (x𝑖)/ cQ*(x𝑖)
5. Accept sample X𝑖, if ui ≤ P* (x𝑖)/ cQ*(x𝑖)
6. Go to step #2
x𝑖
P* (x𝑖)
cQ*(x𝑖)
Rejection Sampling : Summary
• We need a proposal density that covers the target distribution properly
• Again we need sampling from a uniform distribution.
• The acceptance rate of is 1/c
• For n dimensions, acceptance rate is 1/cn
• Even though we use unnormalized target density P*(X) , we get samples from P(X)
• Generated samples are independent
Monte Carlo Method
• The samples xi from the distribution of X should be independent.
• Code name of Law of Large Numbers.
Markov Chain
A sequence of random variables X0, X1, X2, … taking values in the state space {1, 2, . . . , M}
is called a Markov chain if for all n ≥ 0, (Markov Property)
• Here, state space = {Left, Right}
• Random variable Xn denotes position at time t.
• P(Xn+1 = j| Xn = i) is called the transition probability from
state i to state j
• Markov Chain / Process is a Random Process
Markov Chain
• qij = P(Xn+1 = j| Xn = i) is called the transition probability from state i to state j.
• The M x M matrix Q = (qij) is called the transition matrix of the chain.
• Each row of Q sum up-to 1 ;
• We can create a Markov process with state space same as the support of a random variable we want to
sample from. Stationary distribution is same as PDF/PMF.
• We have to properly design transition matrix Q
• In this example if we want to sample from a Bernoulli RV with p=0.416 and 1-p=0.58, this can be done
using the Markov chain but only after being stationary.
• What happens if q12 = q21 = 1 ?
Markov Chain Monte Carlo
• Metropolis-Hestings
• Gibbs Sampling
Suppose, for a stationary distribution s, we have to find out a transition matrix P. We create this Markov
Chain with the help of another transition matrix Q
= =
= =
Metropolis-Hestings Algorithm : Example
Metropolis-Hestings Algorithm : Summary
• MH produces dependent (linearly correlated) samples.
• It requires a burn-in/warm-up period to reach stationarity, after that we can get samples.
• No rule for getting the best proposal density and burn-in time.
An illustrative example of Metropolis sampler can be found here.
Some cases of Metropolis-Hestings Sampler.
• Metropolis Sampler: If, (like Gaussian) then, . So, if then,
the sampler samples more from high density area as expected.
Gibbs Sampling
•
Gibbs sampling can be viewed as a Metropolis method in which a sequence of proposal
distributions Q are defined in terms of the conditional distributions of the joint distribution P(x).
• It is assumed that, whilst P(x) is too complex to draw samples from directly, its conditional
distributions are tractable to work with.
Gibbs Sampling : Intuition
Gibbs Sampling : Example
Gibbs Sampling : Example
Questions ?
Thank you for your patience!