Skip to content

Expected Value Lab

A random variable is a list of outcomes with probabilities. Its expected value is where the bars balance; its variance is how far the mass sits from that point. Draw many times and watch the running mean settle on E[X]: slowly, with wobble of order SD/√n.

Payoff distribution: E[X] is the balance point

bar height = probability; drag a handle to change p (the others rescale)

0.000.100.201p = 0.1672p = 0.1673p = 0.1674p = 0.1675p = 0.1676p = 0.167
Payoff distribution: E[X] is the balance point. 1: x = 1, p = 0.167; 2: x = 2, p = 0.167; 3: x = 3, p = 0.167; 4: x = 4, p = 0.167; 5: x = 5, p = 0.167; 6: x = 6, p = 0.167. E[X] = 3.50, SD = 1.71.

Running mean of simulated draws

1,000 draws · log n

1101001,000E[X] = 3.50x̄ₙ = 3.55
Running mean of simulated draws: After 1,000 draws the running mean is 3.55; E[X] = 3.50.

Simulated outcomes vs exact probabilities

outline = exact p

10.15120.17530.17540.16150.14960.189
Simulated outcomes vs exact probabilities. 1: 0.151 vs 0.167; 2: 0.175 vs 0.167; 3: 0.175 vs 0.167; 4: 0.161 vs 0.167; 5: 0.149 vs 0.167; 6: 0.189 vs 0.167

E[X] and Var(X) are exact sums over the table. Draws use a seeded generator; the shaded band in the running-mean plot is E ± 2·SD/√n (a CLT-style envelope, not a confidence interval about the data). Payoffs are hypothetical games, not empirical products.

After 1,000 draws the running mean is 3.55; E[X] = 3.50.

Formula

E[X] = Σ xᵢ pᵢVar(X) = Σ pᵢ (xᵢ − E[X])²SD(X̄ₙ) = SD(X)/√n

A game with positive E[X] can lose almost every time (lottery): the mean is pulled by a rare large payoff. The running mean converges to E[X], but the sum of winnings does not converge to anything.

Method: Exact sums over the payoff table; seeded discrete sampling (inverse CDF) · Synthetic, seeded data. Illustrative, not an empirical finding.

Validation: E and Var checked against closed forms for the preset games (tests/unit) · integrated