Weighted Mean and Weighted Variance
When observations don't all carry equal importance — bigger positions, more reliable estimates, more recent data — the mean and variance formulas need weights folded in, and the variance formula in particular changes in a way that trips people up.
Prerequisites: Standard Deviation, Weighted Averages and Mixture Shortcuts
A portfolio holds three positions of very different sizes: $10,000, $50,000, and $940,000, with returns of +8%, +3%, and +1% respectively. What was the portfolio's return? Averaging the three percentages plainly gives , but that treats the tiny $10,000 position as equally important as the $940,000 position — obviously wrong. The weighted mean fixes this by letting each observation contribute in proportion to its importance, and the weighted variance does the analogous fix for measuring spread, though it has a subtlety that catches people out: dividing by the wrong thing at the end.
An analogy: a class grade from unequal assignments
Imagine a course grade built from a quiz (5% of the grade), a midterm (35%), and a final exam (60%). You wouldn't average the three scores equally — a student who aces the quiz and bombs the final should still fail the course. You multiply each score by its weight and add them up. Weighted mean and weighted variance apply the identical idea to any set of numbers where some observations should simply count for more: bigger dollar positions, more reliable (lower-noise) estimates, or more recent data points in a time-decayed average.
The mechanics, one piece at a time
The weighted mean of values with weights is
In plain English: multiply each value by its weight, add those up, then divide by the total weight (not by the count ) — this rescaling is what makes weights that don't sum to 1 work correctly. The weighted variance measures how spread out the values are around that weighted mean, but weighted by the same :
In plain English: for each observation, square its distance from the weighted mean, scale that squared distance by its weight, and again divide by total weight rather than count. The subtlety: when weights represent a sample (as opposed to full population weights or known reliability weights), the simple divide-by-total-weight formula is biased, and a correction factor is needed for an unbiased variance estimate — this is the detail that trips people up, discussed below.
Worked example 1: the portfolio return, weighted correctly
Using the position sizes as weights: total capital is $1,000,000. Weighted mean return . This is far closer to the 1% return of the dominant $940,000 position than the naive unweighted average of 4% — because that position is 94% of the portfolio, its return should dominate the answer, and the weighted mean correctly reflects that.
Worked example 2: weighted variance of analyst forecasts
Three analysts forecast next quarter's EPS as $1.00, $1.20, and $1.50, but you trust them unequally, with reliability weights 0.5, 0.3, and 0.2 (summing to 1, so total weight is 1). Weighted mean: , i.e. $1.16. Weighted variance: , so the weighted standard deviation is , i.e. about $0.191. Compare this to the unweighted variance of the raw three numbers (about 0.043) — weighting shifts both the center (toward the more-trusted $1.00 forecast) and the measured spread, since deviations are now measured from a different, weight-adjusted center.
What this means in practice
Weighted means and variances are everywhere in portfolio math: benchmark-relative returns, factor exposures aggregated across holdings, and volatility estimates that exponentially downweight older observations (EWMA volatility is a weighted variance with time-decaying weights). Getting the weights wrong — or forgetting to weight at all — is one of the most common silent errors in performance reporting, because an unweighted average of percentage returns across positions of wildly different sizes is almost never the number anyone actually wants.
A weighted mean rescales each value by its importance and divides by total weight, not by count; a weighted variance does the same for squared deviations from that weighted mean — using dollar size, reliability, or recency as the weight turns a misleading equal-weighted summary into one that reflects what actually matters.
When weights come from a sample meant to represent a larger reliability structure (not fixed population weights), dividing by alone gives a biased variance estimate — the standard fix divides by instead (the weighted analogue of dividing by ). Software defaults differ on this silently, so a "weighted standard deviation" from two different libraries applied to the same data and weights can legitimately disagree — always check which convention a function uses before comparing results across tools.
Related concepts
Practice in interviews
Further reading
- Casella & Berger, Statistical Inference, ch. 5