Once we know how to generate uniformly distributed random numbers we could generate random numbers reflecting different probability distributions.

To achieve this, we need to work with cumulative distribution function.

The cdf of a random variable is defined as

for discrete

for continuous

Some of the properties of include

■ is a monotonic increasing function of

■ For the continuous case, is the probability density function (pdf), and in discrete case,

is called probability mass function (pmf).

Note that the mean and variance given such a distribution could be computed as:

Mean,

Variance,

We assume we have a set of uniformly distributed random variables .

Inverse transformation method.

Our distribution of interest has a pdf from which we to generate our random variates .

First obtain Since , we generate a uniformly distributed random number and set that to

Given ,

Graphically:

Example.

  1. Uniform distribution between and

, otherwise

Setting this to :

  1. Suppose we want samples from a pdf whose is given by

for all

Then =

Set this to a uniformly distributed random number , and we get

This means

  1. Exponential distribution

for

, otherwise

Setting this to , we get

But, since is also uniformly distributed random number just as we may simplify the expression as

With and

One has to be careful about using it willy-nilly. Possibility of negative correlation exists.

  1. Weibull distribution.

Here pdf

scale parameter shape parameter

is similar to the parameter in exponential distribution.

If , Weibull becomes an exponential. By inverse transformation technique,

,

Note that gamma function

If is a positive integer,

A profile of :

  1. Normal distribution.

If and are independent uniform random variables on (0,1), then

is exactly . We can get a sequence of independent random variables as

() with

One can use a cosine function above to generate similar variates:

But we have to be careful. We should not use ( with and

. They will be spirally correlated due to periodic nature of sin(.) and cos(.) functions.

  1. General method when we want to simulate

● Any empirical distribution

● Any discrete distribution

● Any continuous distribution that can be approximated by a discrete distribution

Obtain ,

and if then

In other words:

If in the range / then is
… / …