Home page for accesible maths 7 Models for continuous random variables

Style control - access keys in brackets

Font (2 3) - + Letter spacing (4 5) - + Word spacing (6 7) - + Line spacing (8 9) - +

7.1 Uniform Distribution: U(a,b)

A continuous random variable for which all outcomes in a given range have equal chance of occurring is said to be uniformly distributed. Specifically, a random variable X has a Uniform distribution over the interval (a,b) if the pdf is given by

fX(x)={1b-aa<x<b,0otherwise.

We write XU(a,b). This pdf for two different sets of parameter values is illustrated on Figure 7.1.

Figure 7.1: The pdfs for two uniformly distributed random variables X with different parameter values.

We find that for all x and x+c such that a<x<x+c<b

P(x<Xx+c)=c/(b-a),

so the probability of X falling in any interval of length c in the range (a,b) is the same for all x, i.e. independent of the position x and proportional to the interval length c.

Possible examples of Uniform random variables are: completely random numbers, the time of births in a 24 hour period, and the times of goals in a football match (Or are they?).

Example 7.1.

Find the cdf, expected value and variance of the U(a,b) distribution.

Solution.

The cdf is given by

FX(x) = -xfX(s)𝑑s
= {-x0𝑑s if xa,-a0𝑑s+ax1b-a𝑑s if a<xb,-a0𝑑s+ax1b-a𝑑s+bx0𝑑s if b<x,
= {0 if xa,x-ab-a if a<xb,1 if b<x.

The expectation is

E(X)=-xfX(x)𝑑x=abxb-a𝑑x=b2-a22(b-a)=b+a2.

To calculate the variance, we first calculate

E(X2)=-x2fX(x)𝑑x=abx2b-a𝑑x=b3-a33(b-a)=b2+ab+a23.

So the variance is

Var(X)=E(X2)-(E(X))2=b2+ab+a23-(b+a2)2=(b-a)212.

These results seem logical as if all values in the interval (a,b) are equally likely then the expected value should be the average of the endpoints. Similarly the wider the interval the more variable the outcomes, hence the larger variance.

Exercise 7.2.

Find the upper quartile of the random variable XU(3,5).

Solution.

Note that x0.75 lies in (3,5).

P(X<x0.75) = 0.75
x0.75-35-3 = 0.75
x0.75 = 4.5.
Exercise 7.3.

If XUniform(0,10), use R to calculate the probability that (a) X<3, (b) X>6, (c) 3<X<8, (d) 8<X<10, (e) 8<X<13.

 punif(3,min=0,max=10)
 1-punif(6,0,10)
 punif(8,0,10)-punif(3,0,10)
 punif(10,0,10)-punif(8,0,10)
 punif(13,0,10)-punif(8,0,10)
Exercise 7.4.

Suppose that you know the score in your favourite team’s football league match was 1-0. You video the game. Assuming a Uniform distribution for the time of goals (and no half-time gap), what is the expected waiting time until the goal? What is the probability the goal is in the first half of the match?

Solution.

Let X model the time to the goal. If XU(0,90) then E(X)=45 mins and F(45)=0.5.