0% found this document useful (0 votes)
5 views

Probability Integral Transformation

Uploaded by

ratangulipilli
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Probability Integral Transformation

Uploaded by

ratangulipilli
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Generating Continuous Random Variables

kundan [email protected]

0.1 The Probability Integral Transformation


Let a random variable X have continuous cumulative distribution function
FX (x) and define a random variable Y as Y = FX (X). Then Y is uniformly
distributed on (0, 1), i.e., P (Y ≤ y) = y, 0 < y < 1.
Proof : We know,

FY (y) = P (Y ≤ y)
= P (FX (X) ≤ y)
−1
= P (X ≤ FX (y)) ∵ FX (x) is a monotone increasing.
−1
= F (FX (y))
=y

Thus, Y ∼ U (0, 1).


−1
* If FX is monotonic, then FX is well defined by
−1
FX (y) = x ⇔ FX (x) = y.

Example: If X is an exponential random variable with rate 1, then its distri-


bution function is given by
F (x) = 1 − e−x
If we let x = F −1 (u), then

u = F (x) = 1 − e−x

or
1 − u = e−x
or, taking logarithms
x = − log(1 − u)
Hence, we can generate an exponential with parameter 1 by generating a random
number U and then setting

X = F −1 (U ) = − log(1 − U )

1
If an exponential random variable with rate λ (mean 1/λ) can be generated
by generating a random number U and setting
1
X = − log U.
λ
Example: Consider X is a continuous random variable with PDF and CDF is
defined as follows:
α
fX (x, α, λ) = αλxα−1 e−λx , x > 0, α, λ > 0,
α
FX (x, α, λ) = 1 − e−λx .

This is a Weibull distribution with shape parameter α and scale parameter λ,


respectively.

Example: Consider X is a continuous random variable following Weibull


Extension distribution with CDF is defined as follows:

1 − exp {−β(exp(xα ) − 1)}

Example: Suppose we want to generate the value of a gamma(n, β) random


variable. Since the distribution function, F of such a random variable is given
by Z x −βy
βe (βy)n−1
F (x) = dy
0 (n − 1)!
It is not possible to give a closed form expression for its inverse. However, by
using the result that a gamma(n, β) random variable X can be regarded as
being the sum of n independent exponentials, each with rate β. Specifically, we
can generate a gamma(n, β) random variable by generating n random numbers
U1 , . . . , Un and then setting
1 1
X =− log U1 − · · · − log Un
β β
1
= − log(U1 · · · Un ).
β

2
0.2 The Rejection Method
Suppose we have a method for generating a random variable having density
function g(x). We can use this as the basis for generating from the continuous
distribution having density function f (x) by generating Y from g and then
accepting this generated value with a probability proportional to fg(Y
(Y )
).
Specifically, let c be a constant such that
f (y)
≤ c for all y.
g(y)
We then have the following technique (illustrated in Figure 5.1) for generating
a random variable having density f .

Algorithm
Step 1: Generate Y having density g.
Step 2: Generate a random number U .
f (Y )
Step 3: If U ≤ cg(Y ) , set X = Y . Otherwise, return to Step 1.

Figure 1: The rejection method for simulating a random variable X having


density function f .

Remark: The basic idea is to find an alternative probability distribution G,


with density function g(x), from which we already have an efficient algorithm
for generating from (e.g., inverse transform method or whatever), but also such
that the function g(x) is “close” to f (x). In particular, we assume that the ratio
f (x)/g(x) is bounded by a constant c > 0; supx f (x)/g(x) ≤ c.

Example: Let us use the rejection method to generate a random variable having
density function
f (x) = 20x(1 − x)3 , 0 < x < 1.
Since this random variable (which is Beta with parameters 2, 4) is concentrated
in the interval (0, 1), let us consider the rejection method with

g(x) = 1, 0 < x < 1.


f (x)
To determine the smallest constant c such that g(x) ≤ c, we use calculus to
determine the maximum value of
f (x)
= 20x(1 − x)3 .
g(x)

3
Differentiation of this quantity yields
 
d f (x)
= 20 (1 − x)3 − 3x(1 − x)2 .
 
dx g(x)

Setting this equal to 0 shows that the maximal value is attained when x = 41 ,
and thus    3
f (x) 1 3 135
≤ 20 = ≡ c.
g(x) 4 4 64
Hence,
f (x) 256
= x(1 − x)3 .
cg(x) 27
and thus the rejection procedure is as follows:

Step 1: Generate random numbers U1 and U2 .


256
Step 2: If U2 ≤ 27 U1 (1 − U1 )3 , stop and set X = U1 . Otherwise, return to Step
1.
135
The average number of times that Step 1 will be performed is c = 64 ≈ 2.11.

Example: Suppose we wanted to generate a random variable having the


gamma( 32 , 1) density
f (x) = Kx1/2 e−x , x > 0.

where K = 1/Γ(3/2) = 2/ π. Because such a random variable is concentrated
on the positive axis and has mean 23 , it is natural to try the rejection technique
with an exponential random variable with the same mean. Hence, let
2 −2x/3
g(x) = e , x > 0.
3
Now,
f (x) 3K 1/2 −x+2x/3
= x e .
g(x) 2
By differentiating and setting the resultant derivative equal to 0, we find
that the maximal value of this ratio is obtained when
1 −1/2 −x/3 1
x e = x1/2 e−x/3
2 3
that is, when x = 23 . Hence,
   1/2
f (x) 3K 3
c = Max = e−1/2
g(x) 2 2
33/2 2
= since K=√ .
(2πe)1/2 π

4
Since  1/2
f (x) 2e
= x1/2 e−x/3 ,
cg(x) 3
we see that a gamma 23 , 1 random variable can be generated as follows:


Step 1: Generate a random number U1 and set Y = − 32 log U1 .


Step 2: Generate a random number U2 .
1/2 −Y /3
Step 3: If U2 < 2eY
3 e , set X = Y . Otherwise, return to Step 1.

You might also like