Alias Method Vector Generation
Alias Method Vector Generation
Sravan Danda
Outline
1 Recap
Recap · · ·
The set-up
1 Suppose P, P(k) , Q(k) , k ≤ n − 1 represent p.m.fs on the
integers {1, 2, · · · , n}
2 The vector P(k) has at most k non-zero components
3 The vector Q(k) has at most 2 non-zero components
Alias-Method: Any probability mass function P can be
represented as an equally weighted mixture of n − 1 probability
mass functions Q i.e. P can be expressed as:
1 n−1
X
P= Q(k) (1)
n − 1 k=1
Simulating Discrete Random Variables
The Alias Method for Generating Discrete Random Variables
Screenshot Source 1
1
https://stats.stackexchange.com/questions/198431/how-to-understand-the-alias-method-for-generating-
discrete-random-variables
Simulating Discrete Random Variables
The Alias Method for Generating Discrete Random Variables
Screenshot Source 2
2
https://stats.stackexchange.com/questions/198431/how-to-understand-the-alias-method-for-generating-
discrete-random-variables
Simulating Discrete Random Variables
The Alias Method for Generating Discrete Random Variables
Screenshot Source 3
3
https://stats.stackexchange.com/questions/198431/how-to-understand-the-alias-method-for-generating-
discrete-random-variables
Simulating Discrete Random Variables
The Alias Method for Generating Discrete Random Variables
4
inverse transform method requires O(n) for both construction and simulating a new data point
Simulating Discrete Random Variables
The Alias Method for Generating Discrete Random Variables
Proof.
(1)
Qj = 1 − (n − 1)Pi (4)
Decomposition at step 1
1 n − 2 (n−1)
P= Q(1) + P (5)
n−1 n−1
5
all mass of i is associated to the first of Qs. The conditions on i and j ensure that these values lie between 0
and 1
Simulating Discrete Random Variables
The Alias Method for Generating Discrete Random Variables
Next
(n−1)
Pi =0 (6)
n−1 1 n−1 1
(n−1) (1)
Pj = Pj − Qj = Pi + Pj −
n−2 n−1 n−2 n−1
(7)
This is non-negative from the Lemma
(n−1) n−1
Pk = Pk , k ∈
/ {i, j} (8)
n−2
Simulating Discrete Random Variables
The Alias Method for Generating Discrete Random Variables
r
n! x1 xr
X
P{X1 = x1 , · · · , Xr = xr } = p · · · pr , xi = n (13)
x1 ! · · · xr ! 1 i=1
r is large relative6 to n
P{Yj = i} = pi , i = 1, · · · , r , j = 1, · · · , n (14)
6
many of the outcomes are zeros
Simulating Discrete Random Variables
Generating Random Vectors
n is large relative to r
X1 ∼ Binomial(n, p1 ) (16)
p2
X2 |X1 = x1 ∼ Binomial(n − x1 , ) (17)
1 − p1
p2
X3 |X1 = x1 , X2 = x2 ∼ Binomial(n − x1 − x2 , ) (18)
1 − p1 − p2
Question: Can you find the breaking point on the relative sizes of
r to n at which one of these two methods outperforms the other?
Simulating Discrete Random Variables
Summary and What Next?
Summary
What Next?