Expectation
Often it is useful to have one number summarizing the ''average" value of a random variable. There are several senses in which the word ''average" is used, but by far the most commonly used is the mean of an r.v., also known as its expected value.
In addition, much of statistics is about understanding variability in the world, so it is often important to know how "spread out" the distribution is; we will formalize this with the concepts of variance and standard deviation. As we'll see, variance and standard deviation are defined in terms of expected values, so the uses of expected values go far beyond just computing averages.
Given a list of numbers , the familiar way to average them is to add them up and divide by . This is called the arithmetic mean, and is defined by
More generally, we can define a weighted mean of as
where the weights are pre-specified nonnegative numbers that add up to 1 (so the unweighted mean is obtained when for all ).
The definition of expectation for a discrete r.v. is inspired by the weighted mean of a list of numbers, with weights given by probabilities.
Definition: Expectation of a Discrete r.v.
The expected value (also called the expectation or mean) of a discrete r.v. whose distinct possible values are is
If the support is finite, then this is replaced by a finite sum. We can also write
where the sum is over the support of (in any case, is 0 for any not in the support). The expectation is undefined if diverges, since then the series for diverges or its value depends on the order in which the are listed.
In words, the expected value of is a weighted average of the possible values that can take on, weighted by their probabilities. Let's check that the definition makes sense in two simple examples:
-
Let be the result of rolling a fair 6-sided die, so takes on the values , with equal probabilities. Intuitively, we should be able to get the average by adding up these values and dividing by 6. Using the definition, the expected value is
as we expected. Note though that never equals its mean in this example. This is similar to the fact that the average number of children per household in some country could be 1.8, but that doesn't mean that a typical household has 1.8 children!
-
Let and . Then
which makes sense intuitively since it is between the two possible values of , compromising between 0 and 1 based on how likely each is. This is illustrated in the following figure for a case with : two pebbles are being balanced on a seesaw. For the seesaw to balance, the fulcrum (shown as a triangle) must be at , which in physics terms is the center of mass.
Warning
For any discrete r.v. , the expected value is a number (if it exists). A common mistake is to replace an r.v. by its expectation without justification, which is wrong both mathematically ( is a function, is a constant) and statistically (it ignores the variability of ), except in the degenerate case where is a constant.
Notation
We often abbreviate to . Similarly, we often abbreviate to . Thus is the expectation of the random variable , not the square of the number . In general, unless the parentheses explicitly indicate otherwise, the expectation is to be taken at the very end. For example, is , not . As we will see, the order of operations here is very important!
Linearity of Expectation
The most important property of expectation is linearity: the expected value of a sum of r.v.s is the sum of the individual expected values.
Theorem: Linearity of Expectation
For any r.v.s and any constant ,
We will now show that linearity is true for discrete r.v.s and . Before doing that, let's recall some basic facts about averages. If we have a list of numbers, say , we can calculate their mean by adding all the values and dividing by the length of the list, so that each element of the list gets a weight of :
But another way to calculate the mean is to group together all the 1's, all the 3's, and all the 5's, and then take a weighted average, giving appropriate weights to 1's, 3's, and 5's:
This insight - that averages can be calculated in two ways, ungrouped or grouped---is all that is needed to prove linearity (in the discrete case)! Recall that is a function which assigns a real number to every outcome in the sample space. The r.v. may assign the same value to multiple sample outcomes. When this happens, our definition of expectation groups all these outcomes together into a super-pebble whose weight, , is the total weight of the constituent pebbles. This grouping process is illustrated in the following figure for a hypothetical r.v. taking values in . So our definition of expectation corresponds to the grouped way of taking averages.
Left: assigns a number to each pebble in the sample space. Right: Grouping the pebbles by the value that assigns to them, the 9 pebbles become 3 super-pebbles. The weight of a super-pebble is the sum of the weights of the constituent pebbles.
The advantage of this definition is that it allows us to work with the distribution of directly, without returning to the sample space. The disadvantage comes when we have to prove theorems like this one, for if we have another r.v. on the same sample space, the super-pebbles created by are different from those created from , with different weights ; this makes it difficult to combine and .
Fortunately, we know there's another equally valid way to calculate an average: we can take a weighted average of the values of individual pebbles. In other words, if is the value that assigns to pebble , we can take the weighted average
where is the weight of pebble .
This corresponds to the ungrouped way of taking averages. The advantage of this definition is that it breaks down the sample space into the smallest possible units, so we are now using the same weights for every random variable defined on this sample space. If is another random variable, then
Example: Binomial Expectation
For , let's find . By definition of expectation,
This sum can be done with some work, but linearity of expectation provides a much shorter path to the same result. Let's write as the sum of independent r.v.s:
where each has expectation . By linearity,
Example: Hypergeometric Expectation
Let , interpreted as the number of white balls in a sample of size drawn without replacement from an urn with white and black balls. As in the Binomial case, we can write as a sum of Bernoulli random variables,
where equals 1 if the th ball in the sample is white and 0 otherwise. By symmetry, with , since unconditionally the th ball drawn is equally likely to be any of the balls.
Unlike in the Binomial case, the are not independent, since the sampling is without replacement: given that a ball in the sample is white, there is a lower chance that another ball in the sample is white. However, linearity still holds for dependent r.v.s! Thus,