7. Expectation, Averages, Variability 93
7.4 Means and Variances of Distributions
Its useful to know the means, μ = E(X) of probability models derived in Chapter 6.
Example: (Mean of binomial distribution) Let X∼ Bi(n, p). Find E(X).
When x = 0 the value of the expression is 0. We can therefore begin our sum at x = 1. Provided x 6= 0, we can expand x! as x(x − 1)! (so it is important to eliminate the term when x = 0).
Exercise: Does this result make sense? If you try something 100 times and there is a 20% chance of success each time, how many successes do you expect to get, on average?
Example: (Mean of the Poisson distribution)
Let X have a Poisson distribution where λ is the average rate of occurrence and the time interval is of length t. Find μ = E(X).
Solution:
The probability function of X is f (x) = (λt)xx!e−λt. Then μ = E(X) = P∞
x=0
x(λt)xx!e−λt.
As in the binomial example, we can eliminate the term when x = 0 and expand x! as x(x− 1) for x = 1, 2, · · · , ∞.
Note that we used the symbol μ = λt earlier in connection with the Poisson model; this was because we knew (but couldn’t show until now) that E(X) = μ.
Exercise: These techniques can also be used to work out the mean for the hypergeometric or negative binomial distributions. Looking back at how we proved thatP
f (x) = 1 shows the same method of summation used to find μ. However, in Chapter 8 we will give a simpler method of finding the means of these distributions, which are E(X) = nr/N (hypergeometric) and E(X) = k(1− p)/p (negative binomial).
Variability:
While an average is a useful summary of a set of observations, or of a probability distribution, it omits another important piece of information, namely the amount of variability. For example, it would be possible for car doors to be the right width, on average, and still have no doors fit properly. In the case of fitting car doors, we would also want the door widths to all be close to this correct average. We give a way of measuring the amount of variability next. You might think we could use the average difference between X and μ to indicate the amount of variation. In terms of expectation, this would be E (X − μ). However, E (X − μ) = E(X) − μ (since μ is a constant) = 0. We soon realize that to measure variability we need a function that is the same sign for X > μ and for X < μ. We now define Definition 16 The variance of a r.v X is E
h
(X − μ)2 i
, and is denoted by σ2or by Var (X).
In words, the variance is the average square of the distance from the mean. This turns out to be a very useful measure of the variability of X.
Example: Let X be the number of heads when a fair coin is tossed 4 times. Then X ∼ Bi¡ 4,12¢ so μ = np = (4)¡1
2
¢ = 2. Without doing any calculations we know σ2 ≤ 4 because X is always between 0 and 4. Hence it can never be further away from μ than 2. This makes the average square of the distance from μ at most 4. The values of f (x) are
If we keep track of units of measurement the variance will be in peculiar units; e.g. if X is the number of heads in 4 tosses of a coin, σ2 is in units of heads2! We can regain the original units by taking (positive)√
variance. This is called the standard deviation of X, and is denoted by σ, or as SD(X).
Definition 17 The standard deviation of a random variable X is σ = r
Eh
(X − μ)2i
Both variance and standard deviation are commonly used to measure variability.
The basic definition of variance is often awkward to use for mathematical calculation of σ2, whereas the following two results are often useful:
(1) σ2 = E¡ X2¢
− μ2
(2) σ2 = E [X(X − 1)] + μ − μ2
Proof:
(1) Using properties of expectation, σ2 = Eh
(2) sinceX2 = X(X − 1) + X
Formula (2) is most often used when there is an x! term in the denominator of f (x). Otherwise, formula (1) is generally easier to use.
Example: (Variance of binomial distribution) Let X∼ Bi(n, p). Find Var (X).
Solution: The probability function for the binomial is f (x) = n!
x!(n − x)! px(1 − p)n−x so we’ll use formula (2) above,
E [X(X − 1)] =
Now re-group to fit the binomial theorem, since that was the summation technique used to show Pf (x) = 1 and to derive μ = np.
Then
σ2 = E [X (X − 1)] + μ − μ2
= n(n − 1)p2+ np − (np)2
= n2p2− np2+ np − n2p2= np(1 − p)
Remember that the variance of a binomial distribution is np(1− p), since we’ll be using it later in the course.
Example: (Variance of Poisson distribution) Find the variance of the Poisson distribution.
Solution: The probability function of the Poisson is f (x) = μxe−μ
x!
from which we obtain E [X(X − 1)] =
X∞ x=0
x(x − 1)μxe−μ x!
= X∞ x=2
x(x − 1) μxe−μ
x(x − 1)(x − 2)!, setting the lower limit to 2 and expanding x!
= μ2e−μ X∞ x=2
μx−2 (x − 2)!
Let y = x− 2 in the sum, giving
E [X(X − 1)] = μ2e−μ X∞ y=0
μy
y! = μ2e−μeμ= μ2so σ2= E [X(X − 1)] + μ − μ2
= μ2+ μ − μ2 = μ (For the Poisson distribution, the variance equals the mean.) Properties of Mean and Variance
If a and b are constants and Y = aX + b, then
μY = aμX+ b and σY2 = a2σX2
(where μXand σX2 are the mean and variance of X and μY and σ2Y are the mean and variance of Y ).
Proof:
We already showed that E(aX + b) = aE(X) + b.
i.e. μY = aμX+ b, and then σY2 = Eh
(Y − μY)2i
= En
[(aX + b) − (aμX+ b)]2o
= Eh
(aX − aμX)2i
= Eh
a2(X − μX)2i
= a2E h
(X − μX)2 i
= a2σX2
This result is to be expected. Adding a constant, b, to all values of X has no effect on the amount of variability. So it makes sense that Var (aX + b) doesn’t depend on the value of b. Also since variance is in squared units, multiplication by a constant results in multiplying the variance by the constant squared. A simple way to relate to this result is to consider a random variable X which represents a temperature in degrees Celsius (even though this is a continuous random variable which we don’t study until Chapter 9). Now let Y be the corresponding temperature in degrees Fahrenheit. We know that
Y = 9
5X + 32
and it is clear if we think about it that μY = (95)μX+ 32 and that σ2Y = (95)2σ2X.
Problems:
7.4.1 An airline knows that there is a 97% chance a passenger for a certain flight will show up, and assumes passengers arrive independently of each other. Tickets cost $100, but if a passenger shows up and can’t be carried on the flight the airline has to refund the $100 and pay a penalty of $400 to each such passenger. How many tickets should they sell for a plane with 120 seats to maximize their expected ticket revenues after paying any penalty charges? Assume ticket holders who don’t show up get a full refund for their unused ticket.
7.4.2 A typist typing at a constant speed of 60 words per minute makes a mistake in any particular word with probability .04, independently from word to word. Each incorrect word must be corrected;
a task which takes 15 seconds per word.
(a) Find the mean and variance of the time (in seconds) taken to finish a 450 word passage.
(b) Would it be less time consuming, on average, to type at 45 words per minute if this reduces the probability of an error to .02?