Week 05 · Likelihood and maximum likelihood

Derive a Bernoulli estimate and handle the boundary case.

Watch on YouTube

← Week 4 · Subject contents · Week 6 →

Derive a Bernoulli estimate and handle the boundary case.

Work through the problem

A Bernoulli sequence with k successes among n trials has likelihood L(p) = pᵏ(1−p)ⁿ⁻ᵏ. The sequence is fixed while p varies. Logarithms turn the product into ℓ(p) = k log p + (n−k) log(1−p).

For 3 successes in 5 trials, the derivative is 3/p − 2/(1−p). Setting it to zero gives 3(1−p) = 2p, hence p̂ = 0.60. The second derivative is negative in the interior. When every trial succeeds, p⁵ increases all the way to the boundary p = 1. That estimate alone is weak evidence that a failure is impossible.

Bernoulli likelihoods for two sequences. Sequence likelihood by candidate success probability. Series: 3 of 5, 5 of 5.

Bernoulli likelihoods for two sequences.

Run the Python lab

import numpy as np
grid = np.linspace(0, 1, 101)
curves = {"3 of 5": grid**3 * (1-grid)**2, "5 of 5": grid**5}
for case, likelihood in curves.items():
    print(case, f"{grid[likelihood.argmax()]:.2f}")
assert grid[curves["3 of 5"].argmax()] == .6

Output from the lab

3 of 5 0.60
5 of 5 1.00

Practice

  1. What is the MLE after 0 successes in 5 trials?

Check your reasoning

  1. 0, because (1−p)⁵ is largest at p = 0.

← Week 4 · Subject contents · Week 6 →

Further reading · MIT 18.650 · Statistics for Applications