<
>
=
0 , 0
0 ,
) (
x
x e
x f
x
<
>
=
0 , 0
0 , 1
) (
x
x e
x F
x
) 1 ln(
1
) ( 1 ) (
1
y y F x e y x F y
x
= = = =
) 1 ln(
1
) (
1
i i i
R R F X = =
<
>
=
0 , 0
0 ,
) (
1
x
x e x
x f
x

o


o

Continuous Functions without a
ClosedForm Inverse
Some distributions do not have a closed form expression
for their cdf or its inverse (normal, gamma, beta, )
What can be done then?
Approximate the inverse cdf
For the standard normal distribution:
This approximation gives at least onedecimal place
accuracy in the range [0.0012499, 0.9986501]
1975 . 0
) 1 (
) (
135 . 0 135 . 0
1
R R
R F X
~ =
Discrete Distributions
An Empirical Discrete Distribution
p(0) = P(X=0) = 0.50
p(1) = P(X=1) = 0.30
p(2) = P(X=2) = 0.20
Can we apply the inverse transform technique?
s
< s
< s
<
=
x
x
x
x
x F
2 , 0 . 1
2 1 , 8 . 0
1 0 , 5 . 0
0 , 0
) (
Discrete Distributions
Let x
0
= , and x
1
, x
2
, , x
n
, be the ordered probability
mass points for the random variable X
Let R be a random number
i i i
x X x F R x F if = s <
) ( ) (
1
Discrete Distributions
A Discrete Uniform Distribution
] 1 , 1 [
, 1
, 1 ,
1 , 0
) (
., . . , 2 , 1 ,
1
) (
e
s
+ < s
<
=
= =
k
x k
i f or i x i
k
i
x
x F
k x
k
x p
) (
1
kR roundup X or
i X
k
i
R
k
i
if
=
= s <
Discrete Distributions
The Geometric Distribution
Some algebraic manipulation and
( )
( ) . . . , 2 , 1 , 0 , 1 1 ) (
. . . , 2 , 1 , 0 , 1 ) (
1
= =
= =
+
x p x F
x p p x p
x
x
( )
( )


.

\

= 1
1 ln
1 ln
p
R
roundup X
AcceptanceRejection Technique
Useful particularly when inverse cdf does not exist in
closed form, a.k.a. thinning
Illustration: To generate random variates, X ~ U(1/4, 1)
R does not have the desired distribution, but R
conditioned (R) on the event {R > } does.
Efficiency: Depends heavily on the ability to minimize
the number of rejections.
Procedures:
Step 1. Generate R ~ U[0,1]
Step 2a. If R >= , accept X=R.
Step 2b. If R < , reject R, return
to Step 1
Generate R
Condition
Output R
yes
no
AcceptanceRejection Technique
Poisson Distribution
N can be interpreted as number of arrivals from a
Poisson arrival process during one unit of time
Then time between the arrivals in the process are
exponentially distributed with rate o
. . . , 2 , 1 , 0 ,
!
) ( ) ( = = = =
n
n
e
n N P n p
n
o
o
+
= =
< s =
1
1 1
1
n
i
i
n
i
i
A A n N
AcceptanceRejection Technique
Step 1. Set n = 0, and P = 1
Step 2. Generate a random number R
n+1
and let P = P. R
n+1
Step 3. If P < e
o
, then accept N = n. Otherwise, reject
current n, increase n by one, and return to step 2
How many random numbers will be used on the average to
generate one Poisson variate?
[ [
+
=
=
+
= =
+
= =
> >
< s < s
1
1 1
1
1 1
1
1 1
ln
1
1 ln
1
1
n
i
i
n
i
i
n
i
i
n
i
i
n
i
i
n
i
i
R e R
R R A A
o
o o
Direct Transformations
dx e x
t
x
2
2
2
1
) (
}
= u
t
Consider two normal variables Z
1
and Z
2
( )
( )
2 2 2
1 2
1
1
2
1 1 2
2 1 2
~ with twodegrees of freedom
(Exponential with parameter 2)
tan ~ [0, 2 ]
2ln
2ln cos 2
2ln sin 2
B Z Z Chi square
Z
Uniform
Z
B R
Z R R
Z R R
u t
t
t
= +
 
=

\ .
=
=
=
Direct Transformation
Approach for normal(,o
2
):
Generate Z
i
~ N(0,1)
Approach for lognormal(,o
2
):
Generate X ~ N(,o
2
)
Y
i
= e
X
i
X
i
= + o Z
i
Convolution Method
Erlang Distribution
An ErlangK random variable X with parameters (K, u) (1/u is the
mean, K is the stage number) can be obtained by summing K
independent exponential random variables each having mean
1/(K u)


.

\

= =
=
[
= =
=
K
i
i i
K
i
K
i
i
R
K
R
K
X
X X
1 1
1
ln
1
ln
1
u u
Much more than documents.
Discover everything Scribd has to offer, including books and audiobooks from major publishers.
Cancel anytime.