M06.7 · Expectation, variance and moments
M06.7 L1 · Core 4 lessons · about 100 min Live · in review
Part of M06 Probability I in the Mathematics track.
A whole distribution is a lot to carry around. These four lessons boil it down to a few numbers that do most of the work: the expectation, which is where the distribution balances and what a long run of draws averages to; the variance and standard deviation, which say how far it spreads; and the higher moments, skewness and kurtosis, which describe its lean and its tails. Along the way come the rules that make these numbers easy to compute, linearity of expectation and the variance of a sum, and the fact behind every squared-error loss: the mean is the best single guess.
What you need first. Random variables, PMFs and independence of random variables (M06.5), densities and the normal density (M06.6), and integrals, including integration by parts (M04.5 to M04.7). The code uses Python with fractions, NumPy and scipy.stats.
Lessons
Expectation: the long-run average M06.7.1 25 min
The expectation of a random variable is the average of its values weighted by their probabilities: the balance point of its distribution and the number a long run of draws settles on. Learn it for PMFs and densities, and for any function of X.
Linearity of expectation M06.7.2 25 min
The expectation of a sum is the sum of the expectations, with no independence needed. Prove it over the sample space, count with indicators to get the expected heads in n flips and the expected shared birthdays among 23 people, and see where products and nonlinear functions break the pattern.
Variance and standard deviation M06.7.3 25 min
The variance is the expected squared distance from the mean and the standard deviation is its square root, in the units of X. Derive the shortcut E[X²] − (E[X])², how shifts, stretches and independent sums change the spread, and why the spread of a sum grows like √n.
Standardising and higher moments M06.7.4 25 min
Subtract the mean and divide by the standard deviation and any variable gets mean 0 and variance 1. Prove that μ and σ² are the mean and variance of N(μ, σ²), read a distribution’s lean and tails from E[Z³] and E[Z⁴], and see why the mean is the best guess under squared error.
The interactive
M06.7-X1 · Balance beam. A PMF on the values 0 to 6 stands as weights on a beam that balances at its mean, with a band one standard deviation either side. Raise or lower any bar and the rest rescale to keep the total 1; shift and stretch the variable and watch the mean follow while the band ignores the shift. It lives in Variance and standard deviation.