10 Expectation
Probabilities tell us how likely particular outcomes are to occur. In this way a probability is the long-run relative frequency of an outcome. We can similarly define the long-run average for a random variable. This expected value is what we would expect to get as we average more and more outcomes of the variable. It can be calculated easily from the random variable’s probability function.
Expected Value
A classic application of expected values is in analysing a game of chance like Keno. The table below shows the probability function for the simple one-number game introduced in Chapter 8.
Probability function for Keno winnings
So if you play this Keno game once then you will either win $3 or win $0. But what would you expect to win if you played the game over and over again? For example, playing the game 10 times you might get lucky and win in 4 of them. This gives total winnings of $12, an average of $1.20 per game. Now if you played 100 times or 1000 times, what would you expect this average to be?
You can calculate this by using the probabilities as long term relative frequencies. The probability of winning $3 is
Here we calculated
In the long term we will get $0.75 for each game we play. Unfortunately Keno costs $1 per game and so in the long term we will actually lose $0.25 per game. What makes gambling exciting is the variability in the results, rather than the long term result. We will define the standard deviation of a random variable later in this chapter.
Population Mean
In the sciences we are usually not directly interested in games of Keno. Our main focus has been on the idea of sampling from a population. It turns out in this case that the expected value has a simple interpretation.
Suppose a finite population has
This should look familiar – it is the formula for the sample mean but instead of just a sample we have calculated it for the whole population. Thus for sampling from a finite population the expected value is just the population mean. Instead of
Law of Large Numbers
The law of large numbers simply states that, as the number of trials increases, sample proportions get closer to probabilities and the sample mean gets closer to the expected value.
A common misinterpretation of this idea is that, for example, if you toss a coin five times and you get heads each time then the next toss is more likely to give tails, to balance things up and get closer to the probability of 0.5. Of course this is not true. If the tosses are independent then the sixth toss is still a 50-50 chance of heads or tails. We could get a hundred tails in a row and that would not matter because after a million more tosses the hundred tails would only be a small wrinkle. The law of large numbers only talks about the long-term, not short-term, behaviour. For a nice example of improbable coin tossing, see the beginning of the film Rosencrantz and Guildenstern Are Dead (1990), based on the play by Tom Stoppard.
The phrase “law of large numbers” was first introduced in 1837 by Siméon Poisson, a French mathematician who we will meet again in Chapter 11.
Variance
An expected value is the long-run mean of a random variable so it is natural to quantify variability using squared deviations about this mean, just as we did for samples. Essentially we want the expected squared deviation. In the Keno example if we win $3 then the squared deviation from the mean is
In general,
The units of the variance are squared so as for samples we take the square root to get back to the original units, giving the standard deviation
For the Keno example,
Note that another way of writing the formula for variance is
so variance really is the expected long-run squared deviation from the mean.
Population Standard Deviation
As before, suppose a finite population has
This is the population standard deviation and we often write
Precision
To give an example of how we will think about population means and standard deviations, the simple game of Keno was played 100 times with a computer (so we didn’t lose any real money). We won 28 of the games, a total of $84 in winnings. The sample mean for each game was $0.84 and the sample standard deviation was $1.35.
For this particular example we know the population mean and standard deviation. In dealing with variables for human or animal populations it will be unlikely that we know these parameters. Instead we use our sample statistics to estimate these unknown values. The sample proportion of wins, 0.28, is pretty close to the population probability 0.25. The sample mean $0.84 is close to the population mean of $0.75. The sample standard deviation $1.35 is close to the population standard deviation of $1.30.
Here we know the population values and so we can see how precise our sample statistics are. If we don’t know the population values then how can we be sure our sample statistics are as close as we would like to the unknown values? Estimating the precision of sample statistics is a vital part of statistical analysis and will be discussed starting in Chapter 13.
Continuous Random Variables
So far we have motivated and defined the expected value and standard deviation of a discrete random variable. These were the sums of observations and squared deviations, respectively, weighted by their probability of outcome. Since all the examples given involved finite numbers of outcomes, these values could be calculated directly by using the sums.
For continuous variables this is not possible since there are an uncountable number of outcomes and the probability of any individual outcome is 0. However, calculus provides a notion of sum, the integral, which can be used to make analogous definitions for continuous variables.
Suppose a continuous random variable
the expected value of
The variance is then
giving
These formulas can be difficult to work out by hand, especially if you haven’t done much calculus before. However, many software packages and graphics calculators can now be used to do these calculations exactly, with algebra, or approximately.
Combining Variables
We are frequently interested in the behaviour of combinations of random variables. For example, obtaining a sample mean involves the sum of
Shifting and Scaling
Suppose
We put the absolute value signs around
Now suppose the Casino gives us an extra $2 each time we play, so our winnings come from
Two Random Variables
Suppose we now look at our total winnings from two games of Keno. This is not the same as the
We expect to win $0.75 on the first game and $0.75 on the second game, so in total we expect to win $1.50. In general,
Expected values generally work in this simple intuitive way, giving the same answer as
That is,
For two games of Keno we have
so
There are two important subtleties to be aware of when adding variance. Firstly, variance involves a squaring process and so anything negative becomes positive. Thus
If you have two sources of variability then when you combine them you will always have more variability, even if you are subtracting them. This will be a common use of variance, looking at the difference between two populations.
Secondly, suppose we take a random sample of 10 people and let
Sample data of 10 people
Sample | 1 | 2 | 3 | 4 | 5 |
0.4 | 0.3 | 0.5 | 0.4 | 0.5 | |
0.6 | 0.7 | 0.5 | 0.6 | 0.5 |
There is clearly variability in
When we come to compare populations using statistical analysis we will make extensive use of this formula. Thus our samples will always have to be independent.
Summary
- The expected value of a random variable gives the long-run mean we would expect to see from it.
- The variance of a random variable gives the expected squared deviation of the variable.
- For the random process of sampling from a population the expected value is the population mean and the standard deviation is the population standard deviation.
- Simple formulas allow us to determine the expected value and standard deviation of more complicated random variables without having to work them out from scratch.
Exercise 1
Calculate the expected value and standard deviation of the random variable
Exercise 2
Suppose
Exercise 3
If you know some calculus, evaluate
Exercise 4
As in the section on combining variables, suppose we play two games of Keno and let
- What are the possible outcomes of
? - Assuming the games are independent, determine the probability function for
based on the probability function for in the previous table. - Calculate
and from the probability function to verify the formulas given in the aforementioned section.
Exercise 5
Suppose
Probability function for daily coffees
- What are the expected value and standard deviation of
? - Suppose a café aims to service the coffee needs of 100 students. What are the expected value and standard deviation of the total number of coffees they will sell each day?