# Random sampling from input distributions

Consider the distribution of an uncertain input variable x. The cumulative distribution function F(x) gives the probability P that the variable X will be less than or equal to x, i.e.

F(x) = P(X<=x)

F(x) obviously ranges from zero to one. Now, we can look at this equation in the reverse direction: what is the value of x for a given value of F(x)? This inverse function G(F(x)) is written as:

G(F(x)) = x

It is this concept of the inverse function G(F(x)) that is used in the generation of random samples from each distribution in a risk analysis model.

The figure below provides a graphical representation of the relationship between F(x) and G(F(x)): To generate a random sample for a probability distribution, a random number (r) is generated between zero and one. This value is then fed into the equation to determine the value to be generated for the distribution:

G(r) = x

The random number r is generated from a Uniform(0,1) distribution to provide equal opportunity of an x value being generated in any percentile range. The inverse function concept is employed in a number of sampling methods, discussed in the following sections. In practice, for some types of probability distribution it is not possible to determine an equation for G(F(x)), in which case other techniques have been developed for sampling from them, including generating intermediary distributions to obtain the required distribution (Ripley (1987), Evans et al. (1993), Press et al. (1986), Johnson et al. (1993), Johnson et al. (1994), Johnson et al. (1995) and Gentle (1998) describe many of the methods). However, the principle remains the same and provides sufficient detail.

The figure below illustrates how the Uniform(0,1) distribution is used directly or otherwise to generate most of the commonly used distributions. • No labels