S1 5.3 - Expectation and variance

S1 5.3 - Expectation and variance

Find the mean and variance of a discrete random variable from its probability distribution. Then see how a fixed charge, a change of scale or a negative multiplier changes the average and the spread.

Expected value

Can the average prize be a value that nobody ever wins? Suppose a game pays 00, 22 or 55 pounds with probabilities 0.20.2, 0.50.5 and 0.30.3. In a large number of plays, the more likely prizes contribute more often to the total. The average must therefore weight each prize by its probability.

Expected value

The expected value, E(X)\mathrm E(X), is the probability-weighted mean of a random variable. It describes the long-run average over many repetitions of the same random process; it need not be a possible value in one repetition.

Think of 100100 plays with frequencies close to 2020, 5050 and 3030. Their average prize is close to

20(0)+50(2)+30(5)100=0(0.2)+2(0.5)+5(0.3).\frac{20(0)+50(2)+30(5)}{100}=0(0.2)+2(0.5)+5(0.3).

The probabilities already account for relative frequency. There is no extra division by the number of possible values.

Discrete expectation

For values xx with probabilities p(x)=P(X=x)p(x)=\mathrm P(X=x),

E(X)=∑xxp(x).\mathrm E(X)=\sum_x xp(x).

In the formula booklet.

Use every value in the support, including zero and negative values when they occur.

Worked example 1: the average prize

The distribution of XX, a prize in pounds, is

xx002255
P(X=x)\mathrm P(X=x)0.20.20.50.50.30.3

Find E(X)\mathrm E(X).

Plan. Multiply each prize by its probability, then add.

E(X)=0(0.2)+2(0.5)+5(0.3)=2.5.\mathrm E(X)=0(0.2)+2(0.5)+5(0.3)=2.5.

Answer. The expected prize is £2.50\pounds 2.50, although no single prize is £2.50\pounds 2.50.

Check. The 100100-play frequency calculation gives a total of £250\pounds 250, or £2.50\pounds 2.50 per play. The mean is between the smallest and largest prizes.

Keep the prizes fixed, but move probability 0.20.2 from the 22-pound prize to the zero prize. The mean should fall.

Worked example 2: changing the probabilities

Find E(Y)\mathrm E(Y) for this revised prize distribution.

yy002255
P(Y=y)\mathrm P(Y=y)0.40.40.30.30.30.3

Plan. Use the revised probability weights with the same prizes.

E(Y)=0(0.4)+2(0.3)+5(0.3)=2.1.\mathrm E(Y)=0(0.4)+2(0.3)+5(0.3)=2.1.

Answer. E(Y)=2.1\mathrm E(Y)=2.1, or an expected prize of £2.10\pounds 2.10.

Check. Moving probability 0.20.2 from a prize of 22 to a prize of 00 reduces the mean by 0.2(2−0)=0.40.2(2-0)=0.4. This agrees with 2.5−2.1=0.42.5-2.1=0.4.

If a player pays a fixed entry fee, expected profit is expected prize minus that fee. An expected profit of zero makes a game fair in the financial sense; it does not make all its prizes equally likely.

Watch out

E(X)\mathrm E(X) is not the unweighted average of the listed values. Do not divide ∑xp(x)\sum xp(x) by the number of values: the probability weights sum to 11 already.

Apply the weighting to a new distribution.

Second moments and variance

Two games can have the same average prize but very different risks. Variance measures how far the possible values lie from their mean, weighting those squared distances by probability.

Variance

If μ=E(X)\mu=\mathrm E(X), the variance is

Var⁡(X)=E((X−μ)2).\operatorname{Var}(X)=\mathrm E\bigl((X-\mu)^2\bigr).

Its square root is the standard deviation. Variance has squared units; standard deviation has the same units as XX.

Expanding the square gives a convenient calculation:

E((X−μ)2)=E(X2)−2μE(X)+μ2=E(X2)−μ2because E(X)=μ.\begin{aligned} \mathrm E\bigl((X-\mu)^2\bigr) &=\mathrm E(X^2)-2\mu\mathrm E(X)+\mu^2\\ &=\mathrm E(X^2)-\mu^2 &&\text{because }\mathrm E(X)=\mu. \end{aligned}

The second moment, E(X2)\mathrm E(X^2), means square each possible value before weighting it. This differs from squaring the mean.

Variance from moments

E(X2)=∑xx2p(x),Var⁡(X)=E(X2)−[E(X)]2.\mathrm E(X^2)=\sum_x x^2p(x),\qquad \operatorname{Var}(X)=\mathrm E(X^2)-[\mathrm E(X)]^2.

In the formula booklet.

Keep full precision in the mean until its square has been subtracted.

Worked example 3: a second moment

For XX taking 0,2,50,2,5 with probabilities 0.2,0.5,0.30.2,0.5,0.3, find Var⁡(X)\operatorname{Var}(X). Its mean is 2.52.5.

Plan. Find E(X2)\mathrm E(X^2), then subtract the square of the mean.

E(X2)=02(0.2)+22(0.5)+52(0.3)=9.5Var⁡(X)=9.5−2.52=3.25.\begin{aligned} \mathrm E(X^2)&=0^2(0.2)+2^2(0.5)+5^2(0.3)=9.5\\ \operatorname{Var}(X)&=9.5-2.5^2=3.25. \end{aligned}

Answer. Var⁡(X)=3.25\operatorname{Var}(X)=3.25.

Check. Direct squared deviations give

(−2.5)2(0.2)+(−0.5)2(0.5)+(2.5)2(0.3)=3.25.(-2.5)^2(0.2)+(-0.5)^2(0.5)+(2.5)^2(0.3)=3.25.

This is nonnegative, as a weighted sum of squares must be.

Now add 11 to every prize, keeping the probabilities fixed. The mean moves, but the distances from the mean should stay the same.

Worked example 4: shifting every value

The random variable YY takes 1,3,61,3,6 with probabilities 0.2,0.5,0.30.2,0.5,0.3. Find its variance.

Plan. Calculate both moments for the shifted values.

E(Y)=1(0.2)+3(0.5)+6(0.3)=3.5E(Y2)=12(0.2)+32(0.5)+62(0.3)=15.5Var⁡(Y)=15.5−3.52=3.25.\begin{aligned} \mathrm E(Y)&=1(0.2)+3(0.5)+6(0.3)=3.5\\ \mathrm E(Y^2)&=1^2(0.2)+3^2(0.5)+6^2(0.3)=15.5\\ \operatorname{Var}(Y)&=15.5-3.5^2=3.25. \end{aligned}

Answer. The variance is still 3.253.25.

Check. The deviations are 1−3.5=−2.51-3.5=-2.5, 3−3.5=−0.53-3.5=-0.5 and 6−3.5=2.56-3.5=2.5, exactly the deviations in Worked example 3.

A negative variance signals an error, often confusing E(X2)\mathrm E(X^2) with [E(X)]2[\mathrm E(X)]^2 or rounding too early.

Watch out

The wrong calculation 9.5−2.59.5-2.5 subtracts the mean rather than its square. The correct calculation is 9.5−2.529.5-2.5^2. Neither moment needs a further division by the number of outcomes.

Find both moments before subtracting.

Continue this lesson.

You’re previewing NovaLearn without an account. Create a free account to read the rest.

Create free account