7 Expected Value
- The distribution of a random variable specifies the possible values and the probability of any event that involves the random variable.
- The distribution of a random variable contains all the information about its long run behavior. It is also useful to summarize some key features of a distribution.
- One summary characteristic of a distribution is the long run average value of the random variable.
- We can approximate the long run average value by simulating many values of the random variable and computing the average (mean) in the usual way: sum the simulated values and divide by the number of simulated values.
Example 7.1 Recall the matching problem with
- How could you use the simulation results to approximate the long run average value of
? How could you get a better approximation of the long run average?
- Rather than adding the 10 values and dividing by 10, how could you simplify the calculation in the previous part?
- Table 7.2 below summarizes 24000 simulated values of
. Approximate the long run average value of .
- Recall the distribution of
from Example 5.4. What would be the corresponding mathematical formula for the theoretical long run average value of ? This number is called the “expected value” of .
- Is the expected value the most likely value of
?
- Is the expected value of
the “value that we would expect” on a single repetition of the matching problem?
- Explain in what sense the expected value is “expected”.
# One repetition of the number of matches, for a given n
= function(n) {
simulate_number_matches # sample(1:n) puts the values 1:n in random order
sum(sample(1:n) == 1:n)
}
# Many repetitions, for n = 4
= 24000
N_rep = replicate(N_rep, simulate_number_matches(4))
number_matches
# Summarize the simulated values
table(number_matches) |>
as.data.frame() |>
adorn_totals("row") |>
kbl(col.names = c("Number of Matches (X)",
"Frequency")) |>
kable_styling(fixed_thead = TRUE)
sum(number_matches)
[1] 24066
sum(number_matches) / N_rep
[1] 1.00275
mean(number_matches)
[1] 1.00275
- The expected value (a.k.a. expectation a.k.a. mean), of a random variable
is a number denoted representing the probability-weighted average value of . - The expected value of a discrete random variable with pmf
is defined as - Note well that
represents a single number. - The expected value is the “balance point” (center of gravity) of a distribution.
- The expected value of a random variable
is defined by the probability-weighted average according to the underlying probability measure. But the expected value can also be interpreted as the long-run average value, and so can be approximated via simulation. - Read the symbol
as- Simulate lots of values of what’s inside
- Compute the average. This is a “usual” average; just sum all the simulated values and divide by the number of simulated values.
- Simulate lots of values of what’s inside
Example 7.2 Continuing Example 6.2. Consider an extremely simplified model for the daily closing price of a certain stock. Every day the price either goes up or goes down, and the movements are independent from day-to-day. Assume that the probability that the stock price goes up on any single day is 0.25. Let
- Suggest a shortcut formula for
.
- Compute
using the distribution of from Example 6.2. Did the shortcut formula work?
- Interpret
.
- If
has a Binomial( , ) distribution then .
Example 7.3 Continuing Example 6.1. Assume that
- Compute
.
- Interpret
in context.
- If
has a Poisson( ) distribution then .