Sub topic 15
Expected value, variance and standard deviation
This chapter covers how to summarize a discrete probability distribution of returns with one center and one measure of spread. It assumes you know the probability rules from the previous chapters, can handle sums and exponents, and know what an arithmetic mean is.
Why these three numbers
A random variable is a quantity whose value is uncertain. Next year's return on a stock is one. A discrete distribution lists each possible outcome with its probability. The probabilities must be non-negative and sum to 1.
- Expected value is the probability-weighted average of the outcomes. It is the center of the distribution.
- Variance is the probability-weighted average of squared deviations from the expected value. It measures spread.
- Standard deviation is the square root of the variance. It is in the same units as the returns, so it is what you report and compare.
In finance, standard deviation is the usual measure of total risk for an asset. It is also the building block for portfolio risk, covered later in this part.
Expected value
For outcomes x₁, …, xₙ with probabilities p₁, …, pₙ:
E(X) = Σ pᵢ · xᵢ
Expected value is a forecast average, not a promise. The expected return can be a value that never occurs in any single scenario.
Three useful properties:
- E(c) = c for a constant c.
- E(aX + b) = a·E(X) + b.
- E(X + Y) = E(X) + E(Y), whether or not X and Y are independent.
Variance and standard deviation
For a discrete distribution:
σ²(X) = Σ pᵢ · (xᵢ − E(X))²
σ(X) = √σ²(X)
The squaring does two things. It stops positive and negative deviations from cancelling out, and it penalizes large deviations more than small ones. The cost is that variance is in squared units, such as "percent squared", which has no direct meaning. Taking the square root fixes that.
Properties to remember:
- Var(c) = 0.
- Var(aX + b) = a²·Var(X). Adding a constant does not change spread. Scaling by a multiplies the standard deviation by |a|.
- Var(X + Y) is not generally Var(X) + Var(Y). That equality needs the covariance between X and Y to be zero. The covariance chapter covers this.
Worked example: three scenarios
An analyst assigns these probabilities to next year's return on a stock.
| Scenario | Probability | Return |
|---|---|---|
| Weak | 0.20 | 0.00 |
| Base | 0.50 | 0.08 |
| Strong | 0.30 | 0.15 |
Expected return: 0.2(0) + 0.5(0.08) + 0.3(0.15) = 0.04 + 0.045 = 0.085, or 8.5%.
Variance, deviation by deviation:
- Weak: 0.2 × (0 − 0.085)² = 0.2 × 0.007225 = 0.001445
- Base: 0.5 × (0.08 − 0.085)² = 0.5 × 0.000025 = 0.0000125
- Strong: 0.3 × (0.15 − 0.085)² = 0.3 × 0.004225 = 0.0012675
The sum is 0.002725. The standard deviation is √0.002725 ≈ 0.0522, or 5.22%.
probs = [0.2, 0.5, 0.3]
returns = [0.00, 0.08, 0.15]
expected = sum(p * r for p, r in zip(probs, returns))
variance = sum(p * (r - expected) ** 2 for p, r in zip(probs, returns))
std_dev = variance ** 0.5
print(round(expected, 4)) # 0.085
print(round(variance, 6)) # 0.002725
print(round(std_dev, 4)) # 0.0522A shortcut check
Variance also equals E(X²) − [E(X)]². For the example, E(X²) = 0.2(0) + 0.5(0.0064) + 0.3(0.0225) = 0.00995. Subtracting 0.085² = 0.007225 gives 0.002725, the same answer. This form is quicker when you already have the squared outcomes. It is also a good way to cross-check a calculation.
Properties in action
Suppose the stock's returns in the example are all scaled by 2 (a position with twice the exposure) and then reduced by 1% for fees. Let Y = 2X − 0.01.
- E(Y) = 2(0.085) − 0.01 = 0.16
- Var(Y) = 2² × 0.002725 = 0.0109
- σ(Y) = 2 × 0.0522 = 0.1044
The fee shifts the center but leaves the spread unchanged. The scale factor doubles both the expected return and the standard deviation, and quadruples the variance.
Historical data versus probability models
The formulas above weight outcomes by assumed probabilities. When you instead have a list of past returns, each observation is treated as equally likely, and you use the sample statistics:
- Sample mean: X̄ = ΣXᵢ / n
- Sample variance: s² = Σ(Xᵢ − X̄)² / (n − 1)
- Sample standard deviation: s = √s²
Dividing by n − 1 instead of n corrects for the fact that deviations are measured from the sample mean, which sits closer to the data than the true mean does. Without the correction, the variance estimate is biased low. Use n only when the data are the entire population.
returns = [0.10, -0.05, 0.20]
n = len(returns)
mean = sum(returns) / n
squared_devs = [(r - mean) ** 2 for r in returns]
population_variance = sum(squared_devs) / n
sample_variance = sum(squared_devs) / (n - 1)
print(round(mean, 4)) # 0.0833
print(round(population_variance ** 0.5, 4)) # 0.1027
print(round(sample_variance ** 0.5, 4)) # 0.1258With only three observations, the two answers differ by about 2 percentage points. The gap shrinks as n grows.
Common errors
- Forgetting to square. Summing p·(x − E(X)) gives exactly zero, which is a sign you skipped the square.
- Weighting after squaring the wrong thing. The formula is p × (deviation)², not (p × deviation)².
- Reporting variance as risk in return units. A variance of 0.002725 is not "0.27%". Take the square root first, giving 5.22%.
- Using the sample formula on a probability model, or the reverse. If probabilities are given, weight by them and do not divide by n − 1.
- Assuming variances add. Var(X + Y) = Var(X) + Var(Y) only when the covariance is zero.
- Treating a high expected value as low risk. Expected value and standard deviation are separate measures. Two assets can share one and differ on the other.
- Dropping probabilities that do not sum to 1. Check the sum before computing anything. A distribution with probabilities adding to 0.95 is incomplete.
Exercises
Exercise
A fund manager assigns these probabilities and returns: 25% chance of −10%, 50% chance of +5%, 25% chance of +20%. Calculate the expected return, the variance and the standard deviation.
Show answer
Expected return = 0.25(−0.10) + 0.50(0.05) + 0.25(0.20) = −0.025 + 0.025 + 0.050 = 0.05, or 5%. Deviations from 0.05 are −0.15, 0 and +0.15. Variance = 0.25(0.0225) + 0.50(0) + 0.25(0.0225) = 0.01125. Standard deviation = √0.01125 ≈ 0.1061, or 10.61%.
Exercise
An asset has an expected return of 6% and a standard deviation of 10%. You model a levered version with return Y = 1.5X − 0.02. What are E(Y), Var(Y) and σ(Y)?
Show answer
E(Y) = 1.5(0.06) − 0.02 = 0.07, or 7%. Var(Y) = 1.5² × 0.10² = 2.25 × 0.01 = 0.0225. σ(Y) = 1.5 × 0.10 = 0.15, or 15%. The constant −0.02 shifts the mean but does not affect variance.
Exercise
Four annual returns are 4%, 8%, 12% and −2%, and they are a sample drawn from a longer history. Find the sample standard deviation.
Show answer
Mean = (0.04 + 0.08 + 0.12 − 0.02) / 4 = 0.055. Deviations are −0.015, 0.025, 0.065 and −0.075. Squares are 0.000225, 0.000625, 0.004225 and 0.005625, which sum to 0.0107. Divide by n − 1 = 3 to get 0.003567. The square root gives a sample standard deviation of about 0.0597, or 5.97%.