Random Variables
NZ Level 7 (NZC) Level 2 (NCEA)
Continuous Random Variable
Lesson

Researchers devise experiments or they observe naturally occurring phenomena in order to discover possible connections between things.

For the result of each trial of an experiment or of each observation, the statistical term outcome is used. The outcomes of an experiment or observational study tend to vary in an unpredictable way although they may cluster around a particular typical result.

When we give a numerical value to each outcome we say we have defined a random variable. Random variables are usually denoted by a capital letter: $X,Y,Z$X,Y,Z, etc.

When a random variable can only have a few possible values, we say it is a discrete random variable. This might happen with an opinion survey in which the only possible responses are yes and no. A random variable assigned to the response of a single person might be defined to have the possible values $X=0$X=0 and $X=1$X=1. A different random variable assigned to the collected 'yes' responses of, say, $50$50 people, might have any integer value between $Y=0$Y=0 and $Y=50$Y=50.

In other situations, a random variable that can take a continuous range of values is needed. Such a random variable is called a continuous random variable. When an experiment involves quantities like distance, mass or time a continuous random variable is appropriate.

Briefly, the difference between discrete and continuous random variables corresponds to the difference between counting and measuring.

However, the issue becomes clouded when we realise that measuring instruments only measure to a limited precision so that, in practice, the number of possible values for a measurement is finite and the corresponding random variable, strictly speaking, must be discrete. Thus, the notion of a continuous random variable is an idealisation. In practice, a discrete random variable is approximated for convenience by the continuous kind when the number of possible discrete values is large.

To begin to make sense of a set of measurements from an experiment or from an observational study, we partition the possible values of the relevant random variable into a convenient number of contiguous sub-range intervals. Then, we count the frequency of outcomes within each interval.

A histogram is formed from this grouping of the data. It has columns for each sub-range interval with the height of each column proportional to the number of observations in the particular interval.

We take the proportion of observations in a particular interval as an estimate of the probability that a future observation will fall within that interval.

From the shape of the histogram, we imagine a continuous shape that would be formed if the number of observations could be increased indefinitely while the width of the sub-range intervals is made very narrow. This imagined continuous curve shape corresponds to what is called a probability density function.

The area above a particular interval and below the probability density curve corresponds to the probability that a future observation will fall within that interval. This is a similar idea to the way a histogram works.

The advantage of modelling the spread of a data set with a continuous curve rather than with a histogram is that continuous curves can often be described by a known mathematical function and this can make probability calculations easier.

##### Example 1

The random number feature on a calculator is supposed to generate numbers between $0$0 and $1$1 in such a way that the probability of the next number produced falling within a sub-interval within the interval $(0,1)$(0,1) is equal to the length of the sub-interval.

For example, the probability of getting a number in the interval $(0.5,1)$(0.5,1) is meant to be $0.5$0.5 because this is the length of the interval. Similarly, the probability that the number will be in the interval $(0.25,0.75)$(0.25,0.75) should be $0.5$0.5 because this is the length of the interval. And the probability that the random number is in the interval $(0.125,0.66)$(0.125,0.66) should be $0.535$0.535 for the same reason.

To test whether my calculator is working correctly, I produce a sequence of $51$51 random numbers and separate them into the following 'bins': $(0,0.2],(0.2,0.4],(0.4,0.6],(0.6,0.8],(0.8,1)$(0,0.2],(0.2,0.4],(0.4,0.6],(0.6,0.8],(0.8,1). I make the following table showing the frequencies for each of the five bins.

 interval $(0,0.2]$(0,0.2] $(0.2,0.4]$(0.2,0.4] $(0.4,0.6]$(0.4,0.6] $(0.6,0.8]$(0.6,0.8] $(0.8,1)$(0.8,1) frequency $6$6 $9$9 $14$14 $10$10 $12$12

The corresponding histogram can be represented as follows:

The shape of the histogram suggests that the calculator may be favouring the upper half of the $(0,1)$(0,1) interval but I am not quite ready to throw away my calculator and I consider the possibility that $51$51 trials was not enough.

Perhaps $1051$1051 trials would show a more even distribution, closer in shape to the imagined uniform probability density function, $f(x)=1$f(x)=1 for $0\le x\le1$0x1. This function has the property that the area below the line and between $x=a$x=a and $x=b$x=b is just $b-a$ba. That is, the probability that an outcome is between $a$a and $b$b is just $b-a$ba, the length of the interval.

So, I am treating the output of my calculator as a continuous random variable $X$X that takes values $x$x anywhere in the interval $[0,1]$[0,1] and satisfies the probability density function $f(x)=1$f(x)=1.

Each sub-interval had length $0.2$0.2. So, I expect the proportions in the bins to be close to $0.2$0.2 as the probability that a number will occur in an interval of length $0.2$0.2 should be $0.2$0.2. In fact, the proportions were

$\frac{6}{51}\approx0.118$6510.118
$\frac{9}{51}\approx0.176$9510.176
$\frac{14}{51}\approx0.275$14510.275
$\frac{10}{51}\approx0.196$10510.196
$\frac{12}{51}\approx0.235$12510.235

With $51$51 trials, the nearest we could possibly come to having the exact proportion $0.2$0.2 in each bin would be to have $10$10 observations in each of four of the bins and $11$11 observations in the fifth.

#### Worked Examples

##### Question 1

The data given shows the heights of a group of $16$16 year-olds to the nearest cm.

Heights (cm)
$148,161,154,160,150,153,155,158,156,168,147,157,153,165,148,162,164,163,154,154$148,161,154,160,150,153,155,158,156,168,147,157,153,165,148,162,164,163,154,154
1. Complete the following relative frequency table

Height Frequency Relative Frequency
$145\le h<150$145h<150 $\editable{}$ $\editable{}$
$150\le h<155$150h<155 $\editable{}$ $\editable{}$
$155\le h<160$155h<160 $\editable{}$ $\editable{}$
$160\le h<165$160h<165 $\editable{}$ $\editable{}$
$165\le h<170$165h<170 $\editable{}$ $\editable{}$
$170\le h<175$170h<175 $\editable{}$ $\editable{}$
2. Use the table from part (a) to make a relative frequency histogram.

3. Use your relative frequencies to calculate the probability of a student being between $155$155 and $159$159 cm tall, inclusive.

4. Use your relative frequencies to calculate the probability of a student being less than $155$155 cm.

##### Question 2

The average time ($t$t), in seconds, between $50$50 customers filling up their cars at a petrol station on a Monday morning between $8$8am and $10$10am is given in the relative frequency histogram below.

The results in the range $0\le t<20$0t<20 are represented by the number $20$20.

1. Use the relative frequency histogram to determine the probability of between $0$0 and $19$19 seconds passing, inclusive, between customers.

2. Use the relative frequency histogram to determine the probability of a customer waiting between $80$80 and $139$139 seconds.

##### Question 3

The cumulative frequency for a set of continuous data is given below.

1. Complete the cumulative relative frequency column in the table:

 Hours Cumulative Frequency Cumulative Relative Frequency $725$725$\le t<$≤t<$775$775 $1$1 $\editable{}$ $775$775$\le t<$≤t<$825$825 $1$1 $\editable{}$ $825$825$\le t<$≤t<$875$875 $5$5 $\editable{}$ $875$875$\le t<$≤t<$925$925 $14$14 $\editable{}$ $925$925$\le t<$≤t<$975$975 $29$29 $\editable{}$ $975$975$\le t<$≤t<$1025$1025 $35$35 $\editable{}$ $1025$1025$\le t<$≤t<$1075$1075 $40$40 $\editable{}$ $1075$1075$\le t<$≤t<$1125$1125 $44$44 $\editable{}$ $1125$1125$\le t<$≤t<$1175$1175 $47$47 $\editable{}$ $1175$1175$\le t<$≤t<$1225$1225 $48$48 $\editable{}$ $1225$1225$\le t<$≤t<$1275$1275 $49$49 $\editable{}$ $1275$1275$\le t<$≤t<$1325$1325 $50$50 $\editable{}$
2. Use the data to calculate $P(X<975)$P(X<975).

3. Use the data to calculate $P(X\ge825)$P(X825).

4. Use the data to calculate $P(X<1025\ |\ X\ge875)$P(X<1025 | X875).

### Outcomes

#### S7-4

S7-4 Investigate situations that involve elements of chance: A comparing theoretical continuous distributions, such as the normal distribution, with experimental distributions B calculating probabilities, using such tools as two-way tables, tree diagrams, simulations, and technology.

#### 91267

Apply probability methods in solving problems