Expected Value
The expected value is the probability-weighted average of a random variable — the number a long run of draws settles around. In epidemiology the basic reproduction number is exactly such an expectation: the expected number of secondary infections produced by one case in a fully susceptible population, just as expected survival time is the mean time a patient lives. It anchors nearly every summary in statistics, from the mean of a distribution to the target of an estimator.
Definition
For a discrete random variable with probability mass function ,
For a continuous random variable with density ,
The sum or integral must converge absolutely for the expectation to exist.
Interpretation as a long-run average
If you draw independently many times, the running average of those draws approaches . This is not a metaphor — it is the law of large numbers, and it is why is often called the “mean” of .
Linearity
Expectation is linear. For constants , and for any two random variables, The second identity holds even when and are dependent — a fact used constantly to compute means of sums.
Law of the unconscious statistician
To find the expected value of a function you do not need the distribution of ; you can weight by the distribution of :
Worked example
Fair die. With for , The expected value need not be an attainable outcome.
Exponential. For with density on , With rate , the mean waiting time is .
Simulation
The sample average of many draws should land near .
R
set.seed(1)
die <- sample(1:6, size = 1e6, replace = TRUE)
mean(die) # ~ 3.5
exp_draws <- rexp(1e6, rate = 2)
mean(exp_draws) # ~ 0.5
Python
import numpy as np
np.random.seed(1)
die = np.random.randint(1, 7, size=1_000_000)
print(die.mean()) # ~ 3.5
exp_draws = np.random.exponential(scale=1/2, size=1_000_000)
print(exp_draws.mean()) # ~ 0.5
3.503028
0.5008809237171852
Julia
using Random, Statistics
Random.seed!(1)
die = rand(1:6, 1_000_000)
println(mean(die)) # ~ 3.5
exp_draws = randexp(1_000_000) ./ 2 # rate 2 => mean 0.5
println(mean(exp_draws)) # ~ 0.5
Why it matters for statistics
Expectation defines what an estimator is aiming at: an estimator is unbiased when its expected value equals the parameter. Linearity makes the mean of a sample average trivial to compute, and the law of the unconscious statistician gives variances, moments, and likelihoods without ever deriving a new distribution.