Expectation and variance
Two numbers describe most of what you need from a distribution. Compute them, combine them, and see why planning on the average can mislead.
What runs in CodeSplash
- Descriptive statistics Verified in Python and R
- Monte Carlo simulation of a scenario model Verified in Python and R
You will be able to
- Compute an expected value and a variance from a table of probabilities
- Apply the rules for scaling and adding random variables
- Explain why an expected value isn't what you should expect to get
Read first
The long-run average
ReadThe expected valueExpected valueA random variable's probability-weighted average, where the long-run average of many draws settles. of a random variable is its probability-weighted average: where the long-run average of many draws settles.
A fair die gives , a value you can never roll. That's fine: it's a balance point, not a forecast of one roll.
Should you play?
PredictPredict first
A game costs 3 to play. It pays 10 with probability 1/4, and nothing otherwise. Should you play, going by the average?
Reveal
Skip it. You expect to win and you pay 3, so the expected gain per game is . You'll sometimes win, but over many games you lose.
Spread: variance
ReadThe varianceVarianceThe average squared distance from the mean; the SD squared. is the expected squared distance from the mean, and the standard deviation is its square root:
For the die, the squared distances average , so the standard deviation is about .
These rules carry a lot of statistics:
If and are independent, .
The flaw of averages
ExploreNow plan with an uncertain demand and price. Guess first. Then compare Plugging in averages with Average profit, change Capacity, and watch Chance of a loss.
DExplorable · Monte Carlo risk and the flaw of averages
If you plan on average demand and average price, how wrong can the average plan be?
Compared with plugging in average demand and price, will the average simulated profit be…
You can't sell more than you can make.
Commit your prediction above to see the result
Make your prediction to see the result.
An expected value isn't a promise
ExploreAverage profit in a simulated stocking decision is 3,357 across 5,000 scenarios. The standard deviation is 1,653, and the middle 90% of outcomes runs from 167 to 5,599. Plan for the range as well as for the average.
Check your reading
CheckpointCheck yourself
You flip a fair coin three times. What is the expected number of heads?
Show the answer
Answer: 1.5
. Or use three flips times a half.
Check yourself
has a mean of 10. What is the mean of ?
Show the answer
Answer: 23
.
Check yourself
Independent and have standard deviations 3 and 4. What is the variance of ?
Show the answer
Answer: 25
Variances add, standard deviations don't: , so the standard deviation of the sum is 5, not 7. This is where the standard error of a difference comes from.
Look at your own columns
In the appFor a column of data, the mean and standard deviation estimate these two numbers. Before you trust them, look at the shape: a heavy tail can make the mean a poor summary.
Recap
Recap- is the long-run average, and it may be a value that can never occur.
- Means add up. Variances add up too, but only for independent variables, and scaling by multiplies variance by .
- Plugging averages into a nonlinear plan can give the wrong answer. Simulate the uncertainty.
Concepts in this lesson