Week 4 Flashcards
Composition Method Idea
We have probabilities of different distributions
F(x) = p(1)F1(x) + p(2)F2(x) + …
When to use: want to generate CDF of F, but inverse transformation is difficult or slow
Composition Method Algorithm
- Generate a discrete random variable I defined so that P(I=i) = p(i) for i=1,2,…
- Generate a random variable X from the cdf FI(x)
(The X returned by the algorithm will have distribution F(x))
Example: 1. Generate U1~U(0,1) 2. Generate U2~U(0,1) 3. If U1 < 0.5, set X = -(1/λ1)ln(U2) Otherwise, set X = -(1/λ2)ln(U2)
Inverse Transform Method
You are given an f(x)
Compute F(x)
Compute inverse of F(x) s.t. we have equation for X in terms of U
Generate U~U(0,1)
If U<0.5 (or whatever probability it is), return X = …
Otherwise, return X = …
Composition Method Method
Decompose f(x) - define an indicator function
Compute each F(x)
Compute the inverse of F to get X in terms of U
When Can We Not Use the Inverse-Transform or Composition Method?
When there is no closed form for F(x)
Continuous Acceptance Rejection Method Idea
Generate a random variable Y from an easy distribution and use a rule to decide whether to accept it as a sample of X or not
What is a suitable easy distribution [r(x)] for the Continuous Acceptance-Rejection Method?
It is on the same interval as f(x)
Simple to generate from (e.g. via inverse transform method)
Acceptance-Rejection Algorithm
Requirements:
- r(x) > 0 <=> f(x) > 0 for all x
- c is a constant s.t. f(x) ≤ cr(x) for all x
Algorithm:
- Generate U1~U(0,1) and use this number to generate Y which has density r(x)
- Generate U2~U(0,1) (independent of U1)
- If U2
Continuous Acceptance-Rejection Theorem
i) The random variable generated by the rejection method has density f
ii) The number of iterations of the algorithm that are needed is a random variable with mean c
- The acceptance probability is 1/c
P{U ≤ f(Y)/cr(Y)} = 1/c
How to find constant c in Acceptance-Rejection Method?
We want smallest c s.t. f(x) ≤ cr(x) because we want to maximize acceptance probability
c = max { f(x)/r(x) }
Take derivative w.r.t. x and set equal to 0 to find c
Majorizing Function
t(x) = cr(x)
Discrete Acceptance-Rejection Method Algorithm
Goal: Generate random variable P with prob. mass function pj
We have efficient method for generating random variable Q with prob. mass function qj
Requirements:
- For all j, qj > 0 <=> pj > 0 (P and Q take on the same set of values)
- c is a constant s.t. pj ≤ cqj for all j
Algorithm:
1. Generate U1~U(0,1) and use this number to generate Y which has probability mass function qj
2. Generate U2~U(0,1) (independent of U1)
3. If U2 ≤ py/cqy, set X=Y and stop (y is subscript)
Otherwise, return to step 1
Convolution Method
It is a sum of IDD random variables
Algorithm:
- Generate Y1, Y2, …, Ym independently from their distribution
- Return X = Y1 + Y2 + … + Ym (m-fold convolution of the distribution of Yj)
Composition vs. Convolution
Composition: Expresses distribution function as weigher sum of other distribution functions
F(x) = p1F1(x) + p2F2(x) + …
Convolution: Expresses the random variable itself as a sum of other random variables
X = Y1 + Y2 + … + Ym