Skip to content
Tactiverge

School/✦ Research Engineer/Week 11

Maximum likelihood

A probe's detector counted 12 dust impacts in 4 hours. What impact rate makes that observation least surprising?

About 40 min · 3 goals · Checked by automated tests

1.Why should I care?

When you have a model with an unknown parameter, maximum likelihood is the default way to fit it: rates of failures, success probabilities, noise variances. It also underlies least squares, the workhorse of calibration.

  • ◇ Write a likelihood function from a probability model and data.
  • ◇ Find a maximum-likelihood estimate by maximising the log-likelihood.
  • ◇ Connect MLE under Gaussian noise to least squares.

2.Watch

→ Watch the curve slide along the data: the best position is where the observed points are most probable.

Explains maximum likelihood by sliding a distribution along the data until the observations look most probable.

Length: see YouTube · captions on YouTube · source

Nothing loads from YouTube until you press play.

The video is optional: everything you need is also in the lesson text and the interactive.

3.Predict

A camera sees the landmark 7 times in 10 attempts (binomial). What is the maximum-likelihood estimate of p?

Guess first. Being wrong here is how the surprise works.

4.Discover

Keep the flat prior. Add 7 successes and 3 failures. With a flat prior the posterior is just the normalised likelihood, so its peak is the MLE: check it sits at 0.7. Add more data in the same ratio and watch the peak stay put while it narrows.

Loading the interactive…

Can't use the interactive? Read a description instead

With a flat prior, the grid's posterior bars are the normalised likelihood; the readout states the peak value and k/n, which match. All values appear in the text readout.

5.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1

A gripper succeeds 18 times in 24 attempts. What is the maximum-likelihood estimate of its success probability?

6.Understand

Likelihood

Given a model P(data | θ), the likelihood L(θ) is that same expression read as a function of θ, with the data fixed. It is not a probability distribution over θ (it need not integrate to 1). The MLE θ̂ maximises L, or equivalently the log-likelihood ℓ = ln L, which turns products into sums.

Two classic results

Binomial: ℓ(p) = k ln p + (n − k) ln(1 − p) + c; dℓ/dp = 0 gives p̂ = k/n. Poisson with rate λ over time T: ℓ(λ) = k ln(λT) − λT + c; dℓ/dλ = k/λ − T = 0 gives λ̂ = k/T. The MLE is usually the 'obvious' estimate, now with a justification.

Gaussian noise gives least squares

If yᵢ = f(xᵢ; θ) + εᵢ with εᵢ ~ N(0, σ²) independent, then ℓ(θ) = −Σ(yᵢ − f(xᵢ; θ))²/(2σ²) + c. Maximising ℓ is minimising the sum of squared residuals. Least squares is the MLE when the noise is Gaussian, and only then is it guaranteed optimal in this sense.

Explain it another way

Try every possible rate. For each, ask 'how likely was what I saw?' Pick the rate that makes your data least surprising.

Derivation: The MLE of a Poisson rate
  1. k events in time T, rate λ: P(k | λ) = e^(−λT)(λT)ᵏ / k!.

  2. Log-likelihood: ℓ(λ) = −λT + k ln λ + k ln T − ln k!.

  3. Differentiate: dℓ/dλ = −T + k/λ.

  4. Set to zero: λ̂ = k/T. Second derivative −k/λ² < 0, so it is a maximum.

  5. Example: 12 impacts in 4 h gives λ̂ = 3 per hour.

Worked example 1

12 micrometeoroid impacts are recorded in 4 hours. MLE of the rate and its approximate standard error?

λ̂ = 12/4 = 3 per hour. SE ≈ √(λ̂/T) = √(3/4) ≈ 0.87 per hour.

Common mix-ups

  • The MLE is the most probable value of θ.
    ✓ It makes the data most probable. Saying which θ is most probable needs a prior (Bayes).
  • Least squares is always the best fit.
    ✓ It is the MLE for independent Gaussian noise. With outliers or counts, other criteria do better.

7.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 2 · a fresh version every time

A micrometeoroid detector on a probe records k = 12 impacts in T = 12 hours. Assuming a Poisson process with rate λ, what is the maximum-likelihood estimate of λ, in impacts per hour?

per hour

Practice 3

Least squares is the maximum-likelihood fit when the measurement noise is…

Practice 4

Which is true of the likelihood L(θ)?

Practice 5

A detector records 50 events in 200 s. Using SE ≈ √(λ̂/T), what is the standard error of the rate, in events per second?

per s

8.Apply it

Your rover's hazard camera false-alarms 3 times in 600 frames. Estimate the false-alarm rate and its standard error. How many frames would you need to halve the SE?

9.Reflect

Concepts: Statistical estimation: bias, variance and likelihood · Probability distributions