4.9.17 · D2Probability Theory & Statistics

Visual walkthrough — Statistical estimation — MLE, method of moments

1,958 words9 min readBack to topic

We use the exponential distribution as our worked example because it has exactly one unknown number to guess, so we can draw everything on a flat page.


Step 0 — The story before any symbols

The data are the measured lifetimes:

  • ::: the lifetime (a positive number, e.g. hours) of bulb number .
  • ::: how many bulbs we measured.

Nothing here is scary yet — just a list of positive numbers.


Step 1 — What one bulb's probability looks like

WHY this shape. Exponential curves are the natural model for "waiting until a random event" — memoryless, always positive, one knob. That single knob is exactly what we want to estimate.

PICTURE. The next figure shows two exponential curves: a large- (fast, steep) one and a small- (slow, flat) one. Notice how a bigger starts higher but dives faster.


Step 2 — Probability of ALL the bulbs at once

  • ::: "multiply these together for up to " — the product cousin of a sum.
  • ::: the likelihood; the data are now frozen, and is the variable we slide.

WHY a product. Independent events: probability of "A and B" is . Chain that over all bulbs.

Now collect the pieces. There are copies of (one per bulb), and the exponents add:

  • ::: the height-knobs multiplied.
  • ::: the total of all lifetimes; the exponents merged because multiplying powers of adds their exponents.

PICTURE. Below, is plotted against for a fixed toy dataset. It rises, peaks, then falls — there is one best . That peak is our target.


Step 3 — Why we don't maximize directly (take logs)

  • ::: log-likelihood ("script-L").
  • ::: natural logarithm — the inverse of (see Logarithms). It turns into and turns into .

WHY logs. Two reasons:

  1. is strictly increasing — it never reverses order — so the that maximizes also maximizes . Same peak location.
  2. The product becomes a sum , which is far easier to differentiate. (And it avoids tiny numbers underflowing to zero on a computer.)

PICTURE. The next figure overlays and on the same -axis. The dotted vertical line shows their peaks land at exactly the same — logging changed the shape but not the location of the maximum.


Step 4 — The peak has zero slope (score equation)

Term by term, differentiating with respect to :

  • ::: derivative of is , times the constant .
  • ::: is just a fixed number (data frozen!), so this term is linear in and its slope is that constant.

WHY zero. The derivative is the slope of . On the way up it is positive, on the way down negative; at the peak it is exactly . That crossing point is our estimate.

PICTURE. The figure shows with its tangent line drawn at three places: rising (positive slope), at the peak (flat, slope ), and falling (negative slope). The flat one marks the winner.


Step 5 — Solve for

  • ::: the sample mean (average lifetime). So is exactly .
  • The hat in ::: marks it as an estimate built from data, not the true hidden .

WHY this makes sense. For an exponential, the true mean lifetime is (long-lived bulbs ↔ small rate). If the bulbs averaged hours, the most natural rate to blame is . The maths landed exactly on common sense — and by the Law of Large Numbers, closes in on the true mean as grows, so (it is consistent).

PICTURE. Below, the toy dataset's dots sit on the -axis; their balance point is ; the recovered curve is drawn through them. It's the exponential that "hugs" the data best.


Step 6 — Confirm it's a peak, not a valley

  • ::: the second derivative — how the slope itself is changing.
  • Differentiate again: . The term is constant, so it vanishes.
  • ::: always negative (, ), meaning curves downward everywhere — one single hilltop.

WHY it matters. Negative curvature = concave = a genuine maximum. No risk of accidentally reporting a minimum. Because is concave over the whole range, the peak is unique.

PICTURE. The figure marks the peak and shows the curve bending downward on both sides (the "frown" shape) — the visual signature of a maximum.


Step 7 — The degenerate cases (never leave the reader stranded)

  • All lifetimes zero (). Then is undefined — the formula "wants" infinite rate. Picture: every death is instant, which an exponential can only mimic with (an infinitely tall spike at ). Real bulbs never do this, but you must recognise the boundary.
  • One bulb (). Still works: . The peak of still exists; it's just a noisier guess (large variance — see Bias and Variance).
  • A support-dependent parameter is different. For the uniform , differentiating gives no interior solution — the likelihood keeps rising as shrinks toward , then drops to zero. The MLE is , found by inspection, not calculus. This is the warning the parent note flagged.

PICTURE. The figure contrasts the smooth exponential (nice interior peak) with the uniform's cliff-edge likelihood, whose maximum sits right at the biggest data point.


The one-picture summary

Everything above compressed into a single diagram: data → product → log → derivative → solve → check.

data x1..xn

multiply densities L

take log l

set slope to zero

solve gives 1 over xbar

check curvature negative

Recall Feynman retelling — say it to a friend

We had a pile of lightbulb lifetimes and one hidden knob that decides how fast bulbs die. First we wrote the chance of ONE bulb lasting its measured time — a falling curve . Then, since bulbs are independent, the chance of the WHOLE pile is all those chances multiplied: that product, seen as a function of the knob, is the likelihood. Multiplying is ugly, so we took the log — same peak, but now a friendly sum. At the very top of any smooth hill the ground is flat, so we set the slope to zero, and out popped : the reciprocal of the average lifetime. It even makes sense — slow bulbs (big average) mean a small rate. We double-checked the curvature was a frown, not a smile, so it's really a peak. And we noted the two traps: if the average is zero the formula blows up, and for range-limited models like you must eyeball the biggest data point instead of differentiating.


Why is the likelihood a product?
The bulbs are independent, so the joint probability of all data is each density multiplied together.
Why maximize the log-likelihood instead of ?
is strictly increasing (same peak) and turns the product into an easy-to-differentiate sum.
What is the score equation for the exponential?
, giving .
Why is a maximum, not a minimum?
The second derivative is negative for all , so is concave.
When does differentiation fail to find the MLE?
For support-dependent parameters like , where is found by inspection.