Some Special Method

Exponential Distribution - General Inverse Method

We have already seen that if X~U[0,1] and λ>0, then Y=-λlog(X) ~ Exp(1/λ)

This is actually a special case of a general method: let X be a continuous r.v. with cdf F. Let F-1 be the generalized inverse of F, that is F-1(y) = inf{x:F(x)≥y}
Note that if F is strictly increasing the generalized inverse is just the regular inverse, and that F(F-1(x)) = x
Now say we want to generate a r.v. X with cdf F. Let U~U[0,1], then X=F-1(U) ~ F because
gen2fig1.png - 3470 Bytes

Unfortunately the exponential is just about the only application of this method because it is one of the few r.v's with an explicit formula for the cdf.

The exponential has a relationship with some of the other r.v.s we have discussed and this can be used to generate some of them. For example
gen2fig2.png - 6128 Bytes

Binomial Distribution

Say we want to generate X ~B(n,p). Now we know that if Y1,..,Yn are iid Ber(p) then Y1+..+Yn ~ B(n,p).
so let Ui~U[0,1], Yi = I(0,p)(Ui) and X = Y1+..+Yn, then X~B(n,p)

Normal Distribution (Box-Muller algorithm)

Say U1 and U2 are iid U[0,1] and set
gen2fig3.png - 3560 Bytes
then X and Y are independent standard normal r.v.s
gen2fig4.png - 12584 Bytes
the Jacobian of this transform is:
gen2fig5.png - 11876 Bytes

The problem with this algorithm is that it requires the computation of the sin and the cos functions. Here is a similar and much faster algorithm:
1) generate U1 and U2 are iid U[0,1]
2) set V1 = 2U1 -1, V2 = 2U2 -1 and S =V12 + V22
3) If S>1, return to step 1
otherwise set
gen2fig6.png - 2505 Bytes
then X and Y are iid standard normal. (This is called the polar method)