4.1 Properties of Random Numbers

The first step to simulate numbers from a distribution is to be able to independently simulate random numbers u1,u2,,uN from a continuous uniform distribution between zero and one. From the previous chapter, you should remember that such a random variables has pdf f(x)={1,0x10,otherwise and cdf F(x)={0,x<0x,0x11,otherwise These two are plotted in Figure 4.2.

Pdf (left) and cdf (right) of the continuous uniform between zero and one.

Figure 4.2: Pdf (left) and cdf (right) of the continuous uniform between zero and one.

Its expectation is 1/2 and its variance is 1/12.

This implies that if we were to divide the interval [0,1] into n sub-intervals of equal length, then we would expect in each interval to have N/n observations, where N is the total number of observations.

Figure 4.3 shows the histograms of two sequences of numbers between zero and one: whilst the one on the left resembles the pdf of a uniform distribution, the one on the right clearly does not (it is far from being flat) and therefore it is hard to believe that such numbers follow a uniform distribution.

Histograms from two sequences of numbers between zero and one.

Figure 4.3: Histograms from two sequences of numbers between zero and one.

The second requirement the numbers u1,,uN need to respect is independence. This means that the probability of observing a value in a particular sub-interval of (0,1) is independent of the previous values drawn.

Consider the following sequence of numbers: 0.250.720.180.630.490.880.230.780.020.52 We can notice that numbers below and above 0.5 are alternating in the sequence. We would therefore believe that after a number less than 0.5 it is much more likely to observe a number above it. This breaks the assumption of independence.