Skip to content
BIASED

Expectation and variance

Block 1 of 7~3 min

The centre of a distribution

The topic Functions of random variables showed how to get the full distribution of Y=g(X)Y = g(X): through the CDF, or with the change of variables pY(y)=pX(x)/∣g′(x)∣p_Y(y) = p_X(x)/\lvert g'(x)\rvert. But a full distribution is a whole function. To compare two models, report a benchmark or state what a model should learn, we usually want one or two numbers: where the distribution sits and how wide it is. This topic builds both.

The first number is the expectation. For a discrete XX it weights each value by its probability:

E[X]=∑xx pX(x).\mathbb E[X] = \sum_x x \, p_X(x).

For a continuous XX the sum becomes an integral against the density:

E[X]=∫−∞∞x pX(x) dx.\mathbb E[X] = \int_{-\infty}^{\infty} x \, p_X(x) \, dx.

A fair die gives E[X]=(1+2+⋯+6)/6=3.5\mathbb E[X] = (1 + 2 + \dots + 6)/6 = 3.5, a value it never shows. So the expectation is not "the typical value". It has two other readings.

  • Balance point. Put mass pX(x)p_X(x) at each point xx of a weightless rod. The rod balances at E[X]\mathbb E[X].
  • Long-run average. Average many independent copies of XX, and the average settles near E[X]\mathbb E[X]. The topic The law of large numbers makes this precise.

For the Poisson distribution the sum takes one line:

E[X]=∑k≥1k e−λλkk!=λ∑k≥1e−λλk−1(k−1)!=λ.\mathbb E[X] = \sum_{k \ge 1} k \, e^{-\lambda} \frac{\lambda^k}{k!} = \lambda \sum_{k \ge 1} e^{-\lambda} \frac{\lambda^{k-1}}{(k-1)!} = \lambda .

So λ\lambda is exactly the average count, as promised in Discrete distributions. The other families from the previous topics have these means:

Distribution E[X]\mathbb E[X]
Bern⁡(p)\operatorname{Bern}(p) pp
Bin⁡(n,p)\operatorname{Bin}(n, p) npnp
Geom⁡(p)\operatorname{Geom}(p) 1/p1/p
Pois⁡(λ)\operatorname{Pois}(\lambda) λ\lambda
U(a,b)U(a, b) (a+b)/2(a + b)/2
Exp⁡(λ)\operatorname{Exp}(\lambda) 1/λ1/\lambda
N(μ,σ2)\mathcal N(\mu, \sigma^2) μ\mu

The expected wait for a six is Geom⁡(1/6)\operatorname{Geom}(1/6), so 6 rolls on average.

An expectation can fail to exist: the sum or integral must converge absolutely. The Cauchy distribution, with density 1/(π(1+x2))1/(\pi(1 + x^2)), has tails so heavy that ∫∣x∣ p(x) dx=∞\int \lvert x \rvert \, p(x) \, dx = \infty. Its running averages never settle down.

Answers are saved on the server and tied to this browser until you sign in.