5 Continuous Random Variables

Learning Outcomes

At the end of this chapter you should be able to:

  1. explain the concept of a continuous random variable;
  2. work with probability density functions and cumulative distribution functions;
  3. understand the concept of a uniform distribution;
  4. compute expectations and variances in simple cases;
  5. be able to compute the mean and variance of a uniform distribution using appropriate formulae.

 

 

5.1 Introduction

Discrete random variables take values that form a finite set, or a set that can be listed. Continuous random variables take values in a given interval. For example, let the rv

T denote the time it takes to the next failure of a machines. Then T takes all values
t \ge 0. Now P(T=3 {\rm days}) =0, since this is just one of infinitely many values.

As another example, what is the probability that I hit exactly the centre of a dart board. This is just one point of infinitely many, so this probability is zero.

Continuous random variables do not have probability mass functions. Instead we evaluate probabilities for intervals.

Notation

The interval 0 \le t \le 5 is called a closed interval, as it contains both its end points. We use the notation [0,5] to denote this. We represent this on a number line by closed circles at both ends.

A closed interval. A straight line runs from 0 to 5 along a real number line, with full circles at both ends.
Closed interval.

The intervals 0 \le t < 5 = [0,5) is a semi-closed or semi-open interval, as it contains only one end point. The number line representation has a closed circle at the closed end and an open circle at the open end.

A semi-open interval. a straight line runs from 0 to 5 along the real number line, with a full circle at 0 and an empty circle at 5.
A semi-open interval.

The interval 0 < t < 5 = (0,5) is an open interval, as it contains neither end point. The number line representation has open circles at both ends.

An open interval. A straight line runs from 0 to 5 along a real number line, with open circles at both ends.
An open interval.

5.2 Probability density function

The probability density function (pdf) f_X(x) for a continuous random variable X is a function that satisfies

  1. f_X(x) \ge 0 or all values of x,
  2. the total area under the graph of f_X(x) is 1,
  3.  P(a \le X \le b) = area under the graph of f between x=a and x=b.
Probability density function. The graph shows a curve starting from 0.5 on the y-axis, approaching the x-axis as a horizontal asymptote as x goes to infinity. The graph for negative x-values is a reflection of that for the positive x-axis. The area bound by the lines x = -2, x = 2 and the curve is shaded, and labelled "Probability = Area".
Probability density function.

In the examples we consider the areas will be calculated using geometry. Students who know calculus can obtain the probabilities (areas) by integration. Thus

    \[P(a \le X \le b) = \int_a^b f_X(x)\ dx.\]

Example 5.1 

A random variable X has pdf

    \[f_X(x) = \begin{cases} x, & 0 \le x \le B\\ 0, & {\rm otherwise} \end{cases}\]

(a) Find the value of B.

(b) Evaluate

(i) P(0 \le X \le 1), \qquad

(ii) P( 1 \le X \le 1.4), \qquad

(iii) P(X=1).

Solution

First we plot a graph of the probability density function. This is given below, with some areas highlighted (for later parts).

The pdf for Example 5.1. The graph is of the line y = x, The equation of the line is given as f(x) = x, between x = 0 and x = square root of 2. The area between x= 0 and x = 1 shaded in blue and labelled 0.5. Further, the area between x = 1 and x = 1.4 is shaded light blue and labelled 0.48.
The pdf for Example 5.1.

(a) The total area under the graph is 1. This is simply the area of a triangle, so

    \[{\rm Area}= \tfrac{1}{2}B \times B = 1 \Rightarrow B = \sqrt{2}.\]

(b) (i) P(0 \le X \le 1) = \tfrac{1}{2} \times 1 \times 1 = \tfrac{1}{2} = 0.5.

(ii) We can calculate the required probability as the area of a trapezium, given by the average of the parallel sides times the vertical distance between them.

    \[P(1 \le X \le 1.4) = 0.4 \times \frac{1 + 1.4}{2} = 0.48.\]

Alternativley,

    \[P(1\le X \le 1.4) = P(0 \le X \le 1.4) - P(0 \le X < 1) = \tfrac{1}{2}\times 1.4^2 - 0.5 = 0.48.\]

(iii) P(X=1) = 0, as this is the area under a single point.

Note for continuous random variables, since the area under a point is zero, P( a < X \le b) = P(a < X < b).

Example 5.3: THE UNIFORM DISTRIBUTION

The random variable X has a uniform distribution on the interval [a,b], b>a, if its pdf is

    \[f_X(x) = \begin{cases} \frac{1}{b-a}, & a \le x \le b\\ 0, & \text\ otherwise. \end{cases}\]

The total area under the graph is 1, and this determines the height of the graph.

The probability density function of the U(a,b) distribution. The graphs shows a horizontal line y = 1/(b-a) between x = a and x = b. The point (a,0) is labelled a and is along the negative x-axis. The point (b,0) is labelled b, and the equation of the graph is given as f(x) = 1/(b-a).
The probability density function of the U(a,b) distribution.

Then

    \begin{align*} P(x_1 < X < x_2) &= \text{\ Area between\ } x_1 \text{and\ } x_2\\ &= (x_2-x_1).\frac{1}{b-a}\\ &=\frac{x_2-x_1}{b-a}. \end{align*}

5.3 Cumulative distribution function

For continuous random variables, these probabilities are computed as an area, so

    \[F_X(x) = P(X \le x) = {\rm Area\ under\ graph\ in\ the\ interval} -\infty {\rm \ to\ } x.\]

Example 5.4: U[0,1]
We determine the CDF piecewise.
For x<0, F_X(x) = P(X \le x) = 0.

For 0 \le x < 1, F_X(x) = x.

For x \ge 1, F_X(x) = 1.

    \[F_X(x) = \begin{cases} 0, & x<0\\ x, & 0 \le x < 1\\ 1, & x \ge 1. \end{cases}\]

Cumulative distribution function of the U(0,1) distribution. The graph shows the line F(x) = x between x = 0 and x = 1, and the horizontal line f(x) = 1 for x > 1.
Cumulative distribution function of the U(0,1) distribution.

Exercise

For X \sim U[a,b] random variable, show that the cdf is given by

    \[F_X(x) = \begin{cases} 0, & x < a\\ \frac{x-a}{b-a}, & a \le x < b\\ 1, & x \ge b. \end{cases}\]

and sketch it.

5.4 Expectation ◊

If g(x) is a function of x then for a random variable X

    \[E\left[g\left(X\right)\right] = \int_{-\infty} ^ {\infty} g(x).f_X(x)\ dx\]

[Compare with a discrete random variable X: E\left[g\left(X\right)\right] = \sum_{{\rm all\ }x} g(x). p_X(x)]

Example 5.5: U[a,b]

For X \sim U[a,b],

    \[E(X) = \frac{a+b}{2} \quad \text{(mid point of the interval)}\]

and

    \[{\rm Var}(X) = \frac{\left(b-a\right)^2}{12},\]

so the standard deviation is

    \[\sigma_X = \frac{b-a}{\sqrt{12}}.\]

Proof

Exercise.

Example 6.6
For X \sim U[0,1], the mean is

    \[E(X) = \frac{0+1}{2} = \frac{1}{2}\]

and the variance is

    \[{\rm Var}(X) = \frac{\left(1-0\right)^2}{12} = \frac{1}{12}\]

so the standard deviation is

    \[\sigma_X = \frac{1}{\sqrt{12}}.\]

Licence

Icon for the Creative Commons Attribution-NonCommercial 4.0 International License

Statistics: Meaning from data Copyright © 2024 by Dr Nazim Khan is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License, except where otherwise noted.

Share This Book