Home Business & Finance The mathematics of financial models

# NON-UNIFORM NUMBER GENERATION

Given the discussion thus far, it is safe to infer that one can easily generate a uniform number in the (0,1) interval. As a next step, I will discuss the

TABLE 4.3 Generation of Random Numbers Using Latin Hypercube Sampling

TABLE 4.4 Outcome for One Scenario of Latin Hypercube Sampling

 Dimension 1 Stratum 1 Stratum 2 Stratum 3 Stratum 1 X Dimension 2 Stratum 2 Stratum 3 X X

generation of variables from various pdfs. To do this, I will confine my discussion to the following two methods assuming the use of random sampling.[1]

## Inverse Transform Method

[2]

In this method, one uses the generated uniform number to represent a cumulative probability value. Using the cumulative distribution function associated with the random variable of interest, one converts the cumulative probability value to the appropriate simulated random variable using an analytical transformation.[3] In instances where this is not analytically possible, numerical methods can be used to help solve the problem.

To generate a random variable X from a given pdf f(x), one needs to take the following three-step process:

1. Generate a uniform variable in the interval (0,1).

2. Find the cumulative distribution function F(x) associated with the random variable X.

3. Obtain the required random variable by equating F(x) to the uniform number generated in step 1.

TABLE 4.5 Generation of Exponential Random Number

Simulating an Exponential Random Variable To simulate an exponential random variable[4] with a rate parameter of 2 (i.e., for), one would have to deploy the steps discussed above. Since the first step is trivial, I will only focus on the illustration of steps 2 and 3.

To compute step 2, given the pdf of X, it readily follows that the cumulative distribution function, , is given by the expression

To arrive at step 3, one now has to equate F(x) to the generated uniform random number in step 1 to arrive at which can be simplified to

Table 4.5 shows the implementation of the generation of an exponential random variable with a known rate parameter.

Simulating a Standard Normal Random Variable In simulating the exponential random variable, one was fortunate enough to find an expression to perform the inversion analytically. In practice, it is often the case that such tractable expressions cannot be easily obtained. As a consequence, one has to resort to the use of numerical methods. In this section, I illustrate an example of one such instance as I discuss the simulation of a standard normal random variable (i.e., for ).

TABLE 4.6 Generation of Standard Normal Random Number Using Inverse Transform

To implement step 2, observe that the cumulative distribution function, is given by the expression

To implement the final step, one has to equate F(x) to thegenerated uniformrandom number to arrive at the equation . Since this equation cannot be analytically inverted for x, one has to resort to the use of numerical methods. As the Microsoft Excel function “=normsinv(rand())” is able to do this, I will show the implementation of this function in Table 4.6.[5]

• [1] While there are more than these two methods that can be used (e.g., the acception- rejection method), for the purposes of my discussion, I only provide an alternative to the inverse transform method so that the reader can see a faster option to the inverse transform method in instances when a relationship can be found between variables that are generable and those that need to be generated.
• [2] See Ross (2007) for more details.
• [3] To understand the mathematics behind this, suppose that the random variable X has a probability density function f(x) and a cumulative distribution function F(x) = Pr(X < x) where F(x) is a monotonically nondecreasing function that is defined over the same domain. Given any simulated probability, p, in the interval (0,1), one can use F_1{p) to arrive at a unique random variable X.
• [4] If X has an exponential pdf with a rate parameter β, X takes the form f(x) = βe-βx where x, β > 0.
• [5] This can alternatively be done using Newton's method. More precisely, observe that x is a solution of the equation. From Newton's method, it readily follows that x can be recursively computed using the relationship where n = 1, 2, 3, ..., x0 is the initial guess at the solution, and . One should further note that F(x) can also be computed for any given value of x using the Microsoft Excel function “=normsdist(x)”•

Found a mistake? Please highlight the word and press Shift + Enter

Subjects