Computing expectation empirically requires methods to generate iid random variables having a given distribution . The starting assumption will be that there is a technique to produce iid uniform(0,1) random variables.
Inverse Transform Method
An operator on real numbers is a distribution function if the following conditions are satisfied:
is non-negative.
is non-decreasing
is right-continuous.
When is a uniform random variable, note that
. If
is strictly increasing, then
exists and is also strictly increasing. Furthermore,
. Hence
is a random variable with distribution
.
More generally, it is not always the case that the distribution function is invertible. For example, a function with compact support is not invertible. One can define a pseudo-inverse
Since then
:
Suppose . Then
since
is a lower bound. Suppose
. Then for any
there is a
such that
since
is the greatest lower bound. But since
is non-decreasing,
. Since this is true for all
, it follows that
and since
is right-continuous,
. Hence
.
Note that is non-decreasing:
Let . Then when
it follows that
and so
.
and when
is strictly increasing:
Since is strictly increasing,
exists and is strictly increasing. The smallest value of
for which the bound
is satisfied is
.
And so the pseudo-inverse corresponds with the inverse when the inverse exists.
Example : simulating an exponential random variable
Here the density is and the distribution is
. The inverse is
Example : simulating a random variable with density .
In principle, find the partial sum , and set
. Unless the partial sums have a closed form representation that can be inverted the procedure has an unbounded processing time.
Box-Mueller Method
Consider the joint density of independent standard normal random variables:
Switch from a rectangular to a polar coordinate system:
Switch from to
coordinates:
and recognize that this is the product of densities of independent uni(0,) and exp(1/2) random variables. Hence for
normal(0,1) when
exp(1/2) and
uni(0,
)
Since the starting basis of simulation are uni(0,1) random variables, the inverse transform method gives
where uni(0,1)
This technique is known as Box-Mueller approach. As mentioned in Sheldon, the efficiency can be improved by avoiding explicit computation of trigonometric functions. (to be completed)
Acceptance-Rejection Method
This technique was invented by Von Neumann and samples from a target distribution by generating samples from another distribution
and then accepting or rejecting the sample if it passes some test.
Suppose there is a constant such that
. The algorithm:
= gen() {
do {
uni(0,1) and
} while
return
}
Note that
since
