sml
sml
Lecture 4: Acceptance-Rejection
Method
Acceptance Rejection Method
A method to generate “difficult” r.v. from “easy” ones.
1 𝑥2
𝑓 𝑥 = 𝑒− 2 , −∞ < 𝑥 < ∞
2𝜋
• Use a proposal
1 −𝑥
𝑔 𝑥 = 𝑒 , −∞ < 𝑥 < ∞
2
Implementation
In the first example, suppose the sequence of Unif(0,1) generated by the
computer is:
0.10 0.32 0.50 0.49 0.23 0.37 0.58 0.32 0.39 0.99
Implementation
In the first example, suppose the sequence of Unif(0,1) generated by the
computer is:
0.10 0.32 0.50 0.49 0.23 0.37 0.58 0.32 0.39 0.99
Mechanism:
• 𝐶𝑔(𝑥) is an “envelope” that covers 𝑓(𝑥)
• 𝐶 must be at least 1; if 𝐶 = 1, then 𝑓 ≡ 𝑔
• The acceptance probability 𝑓(𝑥)/𝐶𝑔(𝑥) is an
adjustment from sampling 𝑔(𝑥) to sampling 𝑓(𝑥)
Validity
The A-R algorithm indeed generates a random variable with
density 𝑓(𝑥)
𝑃 𝑋 ∈ 𝑥, 𝑥 + Δ𝑥 𝑎𝑐𝑐𝑒𝑝𝑡
𝑃 𝑋 ∈ 𝑥, 𝑥 + Δ𝑥 , 𝑎𝑐𝑐𝑒𝑝𝑡
=
𝑃 𝑎𝑐𝑐𝑒𝑝𝑡
𝑃 𝑌 ∈ 𝑥, 𝑥 + Δ𝑥 × 𝑃 𝑎𝑐𝑐𝑒𝑝𝑡|𝑌 ∈ 𝑥, 𝑥 + Δ𝑥
=
𝑃 𝑎𝑐𝑐𝑒𝑝𝑡
𝑓 𝑥
𝑔 𝑥 Δ𝑥 ×
𝐶𝑔 𝑥
=
1
𝐶
= 𝑓 𝑥 Δ𝑥
Efficiency
• The runtime of the algorithm depends on the number
of trials to obtain one acceptance
• Since the algorithm requires a random number of
trials, it makes sense to consider the expected number
of trials as an efficiency measurement.
• The number of trials to get one acceptance is Geo(p),
where p is the acceptance probability
• The acceptance probability is p=1/C, where C is the
constant that bounds 𝑓(𝑥)/𝑔(𝑥)
• In other words, the expected number of trials to get
one acceptance is 1/p=C
Efficiency
• If 𝑔(𝑥) is close to 𝑓(𝑥), then C is small, so p is large,
and expected number of trials is small
• If 𝑔 ≡ 𝑓, then C=1, so that p=1 and we finish the
random variable generation always in one trial
How to Choose Proposal
• Before we even consider efficiency, we have to make
sure the basic requirement of 𝑔(𝑥) holds
• Requirement 1: 𝑔(𝑥) should have at least the same
support as 𝑓(𝑥)
How to Choose Proposal
• Requirement 2: 𝑔(𝑥) should have a heavier tail than
𝑓(𝑥) in the case that 𝑓(𝑥) has unbounded support
How to Choose Proposal
Most generally, we must be able to find 𝐶 that is finite;
otherwise, the A-R procedure fails
How to Choose Proposal
Can we use the following to generate Exp(1), i.e., with
density 𝑓 𝑥 = 𝑒 −𝑥 for 𝑥 > 0 and 0 otherwise:
1 −𝑥
• Two-sided exponential, i.e., 𝑔 𝑥 = 2
𝑒 , −∞ < 𝑥 < ∞
• Unif(0,1), i.e., 𝑔 𝑥 = 1 for 0 < 𝑥 < 1 and 0 otherwise