Now that we have a few ways to think about expectation, let’s see why it has such fundamental importance. We will start by directly applying the definition to calculate some expectations. In subsequent sections we will develop more powerful methods to calculate and use expectation.
8.2.1Constant¶
This little example is worth writing out because it gets used all the time. Suppose a random variable is actually a constant , that is, suppose . Then the distribution of puts all its mass on the single value , and . We just write .
8.2.2Bernoulli and Indicators¶
If has the Bernoulli distribution, then and . So
As you saw earlier, zero/one valued random variables are building blocks for other variables and are called indicators.
Let be any event. Then the indicator of is the random variable that is 1 if occurs and 0 if doesn’t occur. Thus is has the Bernoulli distribution and
by our calculation above. Thus every probability is an expectation. We will use this heavily in later sections.
x = [0, 1]
qp = [0.75, 0.25]
bern_1_3 = Table().values(x).probabilities(qp)
Plot(bern_1_3, show_ev=True)
plt.title('Bernoulli (0.25)');
Answer
8.2.3Uniform on an Interval of Integers¶
Let and be two integers such that . If has the uniform distribution on the integers , then by symmetry, is half-way between and . That’s where the probability histogram will balance. So
For example, if has the uniform distribution on , then
An instance of this is if is the number of spots on one roll of a die. Then .
If instead is uniform on , then
x = np.arange(10)
probs = 0.1*np.ones(10)
unif_10 = Table().values(x).probabilities(probs)
Plot(unif_10, show_ev=True)
plt.title('Uniform on Integers 0, 1, 2, ..., 9');
Answer
(ii)
🎥 See More
8.2.4Poisson¶
Let have the Poisson distribution. Then
We now have an important new interpretation of the parameter of the Poisson distribution. We saw earlier it was close to the mode; now we know that it is also the balance point or expectation of the distribution. The notation was chosen to stand for “mean”.
k = np.arange(15)
poi_2_probs = stats.poisson.pmf(k, 2)
dist_poi_2 = Table().values(k).probabilities(poi_2_probs)
Plot(dist_poi_2, show_ev=True)
plt.title('Poisson (2)');
Answer
(a) True
(b) True
(c) False
🎥 See More
8.2.5Tail Sum Formula¶
To find the expectation of a non-negative integer valued random variable it is sometimes quicker to use a formula that uses only the right hand tail probabilities where is the cdf of and .
For non-negative integer valued ,
Rewrite this as
Add the terms along each column on the right hand side to get the tail sum formula for the expectation of a non-negative integer valued random variable.
This formula comes in handy if a random variable has tail probabilities that are easy to find and also easy to sum.
8.2.6Geometric¶
In a sequence of i.i.d. Bernoulli trials, let be the number of trials till the first success. We will use the word “till” to mean “up to and including”.
Let . The distribution of is given by
This is called the geometric distribution on because the probabilities are terms in a geometric series.
The right tails of are simple because for each ,
The formula is also true for because .
By the tail sum formula,
🎥 See More
Answer
(a) 6
(b) 3
(c) 2