Skip to content
We use only essential cookies to keep you signed in and remember your preferences. See our Cookie Policy.
TestStop
MocksPracticeResourcesIndiaBlogPricing
Sign in
Resources › Statistical inference › 5. Likelihood
Statistical inference · Lesson 5 of 13

Maximum likelihood and the method of moments

Last lesson judged estimators. This one builds them. Maximum likelihood answers a simple question: of all the values the parameter could have, which makes the data we actually saw the least surprising? The idea needs only a product, a logarithm and a derivative, and it produces the estimators economists use for almost everything, from the sample mean to the logit model.

← Statistical inference moduleLesson 5 of 13 · about 45 minutes
1Joint distributions2Sampling3CLT4Estimators5Likelihood6Intervals7Testing8Tests in practice9Two samples10Chi-square tests11ANOVA12Regression inference13Hard problems
A question to hold on to
A random variable has density f(x, λ) = λe^(−λx) for x ≥ 0. For the sample 1.75, 2.25, 2.50, 2.75, 3.25, what is the maximum likelihood estimator of λ? The options are 5/2, 1/5, 5/12 and 2/5.
IIT JAM 2023Solved at the end ↓
In this guide
Lesson · about 45 minutes
  1. Choosing the parameter that makes the data least surprising
  2. The recipe: likelihood, log, differentiate
  3. Four models, four answers
  4. What the MLE is good for
  5. The method of moments
  6. Neyman's factorisation and sufficiency
  7. The opening question, solved
  8. The lesson on one screen
  9. Check yourself
  10. Past papers, by level
01
The idea

Choosing the parameter that makes the data least surprising

You toss a coin ten times and get seven heads. Is the coin fair? Suppose the probability of heads were p = 0.5. The chance of exactly this sequence of seven heads and three tails would be 0.5¹⁰ = 0.00098. Suppose instead p = 0.7. The chance of the same sequence is 0.7⁷ × 0.3³ = 0.0022, about 2.3 times larger. The data are more probable under 0.7 than under 0.5, so 0.7 is the better explanation. Run through every value of p between 0 and 1 and one value wins. That value is the maximum likelihood estimate.

The function that gives the probability of the observed data for each candidate value of the parameter is the likelihood. It is the same expression as the probability of the data, read the other way round: the data are fixed, and the parameter is the variable.

The likelihood
L(θ)=i=1∏n​f(xi​;θ),θ^MLE​=argθmax​L(θ)
For independent observations the joint probability, or density, is the product of the individual ones.

Note what the likelihood is not. It is not the probability that the parameter equals θ, and it does not add to 1 as θ varies. It only ranks the candidate values against each other.

02
The method

The recipe: likelihood, log, differentiate

The same four steps find the estimator in almost every question.

  1. Write the likelihood as a product of the density or probability of each observation.
  2. Take logs. A log turns the product into a sum, which is easy to differentiate, and it leaves the maximum where it was, since the log is increasing.
  3. Differentiate with respect to the parameter and set it to zero. Solve for the parameter.
  4. Check it is a maximum (the second derivative is negative), or that it is the best of the boundary values, as in the uniform case below.

For the coin: L(p) = p^k (1 − p)^(n − k), so the log-likelihood is k ln p + (n − k) ln(1 − p). Setting the derivative k/p − (n − k)/(1 − p) to zero gives p̂ = k/n, the sample proportion. The MLE of a probability is the share of successes.

03
Interactive

Four models, four answers

The lab shows the likelihood and the log-likelihood side by side for four models. Slide the parameter along its range. The left panel scales the likelihood to 1 at its peak, so you read “this value makes the data 40% as likely as the best one”. The right panel is the log, which has the same peak and is what you would differentiate.

Data: 7 successes in 10 trials.

00.20.40.60.8100.51p: likelihood ÷ its maximum
00.20.40.60.81p: log-likelihood (down to 8 below its peak)
Maximum likelihood estimate0.7
Rulep̂ = k ÷ n, the sample proportion
Log-likelihood at p = 0.5−6.931
Likelihood vs its maximum43.9%

At p = 0.5 the data are only 43.9% as likely as at the maximum, 0.7. Slide towards the dashed line and the likelihood climbs.

The Bernoulli, and a single draw

The estimator is p̂ = k/n, and the lab’s sliders let you test the corner cases. After a single draw, n = 1, the likelihood is p if the draw was a success and 1 − p if it was a failure. The first rises all the way to p = 1 and the second falls from p = 0, so the maximum likelihood estimate is 1 or 0, the end point itself (DSE 2019). It is either 0 or 1, never strictly between: one observation is too little to say anything more moderate.

The exponential

With density λe^(−λx), the likelihood is λⁿ e^(−λΣx), the log is n ln λ − λΣx, and the derivative n/λ − Σx is zero at λ̂ = n/Σx = 1/x̄. The mean of an exponential variable is 1/λ, so the estimator says: set the rate to the reciprocal of the sample mean. For the five observations in the opening question the sum is 12.5, so λ̂ = 5/12.5 = 0.4.

The normal variance

For a normal sample with known mean μ the log-likelihood in σ² is −(n/2) ln(2πσ²) − Σ(xᵢ − μ)²/(2σ²), and the maximum is at σ̂² = Σ(xᵢ − μ)²/n: the average squared deviation from the known mean. For the sample 4.8, 4.5, 5.1, 5.2, 5.3, 5.5 with mean 5 the deviations square to 0.04, 0.25, 0.01, 0.04, 0.09 and 0.25, which sum to 0.68, so σ̂² = 0.68/6 = 0.11(IIT JAM 2024).

When the mean is unknown too, the maximum likelihood estimate of μ is x̄, and that of the variance is σ̂² = Σ(xᵢ − x̄)²/n, dividing by n and not by n − 1. It is therefore biased but consistent (GATE 2024): its expected value is (n − 1)/n times σ², the bias that Lesson 4 met. Maximum likelihood does not promise unbiasedness. Variants with n − 1 in the denominator, or sums that stop at n − 1, are not the MLE.

The uniform, where calculus fails

For a uniform variable on (0, θ), each density is 1/θ if the observation is below θ and 0 otherwise. The likelihood is therefore 0 if θ is smaller than the largest observation, and θ⁻ⁿ above it. That function is decreasing for every θ above the largest observation, so the maximum sits at the left edge: θ̂ = the sample maximum. There is no point where the derivative is zero, so solving the first-order condition would find nothing. For a uniform variable on [a, b] the same logic gives â = the smallest observation and b̂ = the largest. For the sample 1.3, 0.8, 9.5, 20.2, 8.2 that is 0.8 and 20.2 (IIT JAM 2021).

Pause and predict
You have the sample 3.1, 7.4, 5.2, 9.8, 6.5 from a uniform distribution on (0, θ). Could θ = 9?
A caution on the uniform

The sample maximum is always at or below the true θ, so the MLE underestimates: its expected value is nθ/(n + 1). Multiplying by (n + 1)/n removes the bias. Maximum likelihood is a recipe for a good estimator, not a guarantee of an unbiased one.

04
Why it is used

What the MLE is good for

The maximum likelihood estimator is not always unbiased in small samples. It is popular because of what it does as n grows, under mild conditions:

  • Consistent. It converges to the true parameter.
  • Asymptotically normal and efficient. For large n its sampling distribution is close to normal and no other well-behaved consistent estimator has a smaller variance, so it reaches the lowest possible error in the limit.
  • Invariant. If θ̂ is the MLE of θ, then g(θ̂) is the MLE of g(θ), for any function g. The MLE of σ is √σ̂², and the MLE of the mean of an exponential variable, 1/λ, is x̄. Invariance is why we can take the square root of the MLE of variance without redoing the calculation. It is also why the MLE of σ is biased: invariance holds for the MLE, and unbiasedness does not.
In economics

Most estimators in applied economics are maximum likelihood estimators in disguise. Ordinary least squares is the MLE of a regression with normal errors. Logit and probit models have no formula for their coefficients and are fitted by maximising the log-likelihood numerically, in exactly the way the lab slides along the curve.

05
The older method

The method of moments

The method of moments is simpler and older. Write the population mean (and, if needed, higher moments) as a function of the parameter, then set it equal to the sample mean and solve. For the exponential the mean is 1/λ, so x̄ = 1/λ̃ and λ̃ = 1/x̄, the same as the MLE. For a uniform variable on (0, θ) the mean is θ/2, so θ̃ = 2x̄. That is different from the MLE, and it can be impossible: the sample 1, 1, 1, 9 has mean 3, so θ̃ = 6, yet an observation of 9 has just occurred. The method of moments needs no density and is easy to compute, but it can give nonsensical values and it is generally less efficient than maximum likelihood.

06
Information

Neyman’s factorisation and sufficiency

Lesson 4 defined a sufficient statistic as one that carries all the sample’s information about the parameter. The factorisation theorem of Neyman is the test for it (GATE 2026). If the likelihood splits into a part that depends on the data only through a statistic T and the parameter, and a part that does not involve the parameter at all, then T is sufficient.

Neyman's factorisation theorem
L(θ)=g(T(x),θ)⋅h(x) ⟹ T is sufficient for θ

Reading the likelihoods above: the Bernoulli likelihood p^(Σx)(1 − p)^(n − Σx) depends on the data only through Σx, so the number of successes is sufficient. The exponential λⁿe^(−λΣx) depends only on Σx. The uniform θ⁻ⁿ with the condition max ≤ θ depends only on the maximum. In every case the sufficient statistic is exactly what the MLE uses, which is no accident: the MLE is always a function of a sufficient statistic. The factorisation theorem identifies sufficient statistics, and not consistent, efficient or unbiased ones.

Watch out for

The mistakes examiners are fishing for

  • The likelihood is not a probability of the parameter. It is the probability of the data as a function of the parameter.
  • The normal variance MLE divides by n. It is biased. The n − 1 version is the unbiased estimator, not the MLE.
  • Uniform: do not differentiate. The maximum is at the edge, the largest observation.
  • Take logs before differentiating. A product of n terms is painful, a sum is easy.
  • Method of moments and MLE can disagree. For the uniform they give 2x̄ and the sample maximum.
07
Solving the opening question

The opening question, solved

IIT JAM 2023 · moderate
f(x, λ) = λe^(−λx), x ≥ 0. Sample 1.75, 2.25, 2.50, 2.75, 3.25. Find the maximum likelihood estimator of λ.
  1. 1
    Log-likelihood.
    ln L = n ln λ − λΣx.
  2. 2
    Differentiate.
    d ln L / dλ = n/λ − Σx = 0, so λ̂ = n ÷ Σx.
  3. 3
    Substitute.
    n = 5 and Σx = 1.75 + 2.25 + 2.50 + 2.75 + 3.25 = 12.5, so λ̂ = 5 ÷ 12.5 = 0.4 = 2/5.
Answer
λ̂ = 2/5, option D. The option 5/2 is the sample mean x̄ = 2.5, the estimate of 1/λ and not of λ: a reciprocal slip the examiner expected.
08
Revise

The lesson on one screen

The lesson on one screen
Likelihood
L(θ) = product of the densities, with the data fixed and θ varying. The MLE is the θ that maximises it. Not a probability of θ.
Recipe
Write L, take logs, differentiate, set to zero, check the maximum.
Bernoulli, exponential
p̂ = k/n. λ̂ = n/Σx = 1/x̄. A single Bernoulli draw gives p̂ = 0 or 1.
Normal variance
σ̂² = Σ(x − x̄)²/n (or about the known mean). Biased by the factor (n − 1)/n, but consistent.
Uniform
θ̂ = sample maximum (and â = min, b̂ = max on [a, b]). No derivative needed. It underestimates: E = nθ/(n + 1).
Properties
Consistent, asymptotically normal and efficient, invariant under transformations. Not always unbiased.
Method of moments, Neyman
Equate sample and population moments. Factorisation L = g(T, θ) h(x) identifies a sufficient T.
09
Practice

Check yourself

0 of 13 correct so far

Compute

A proportion
7 successes are observed in 20 independent Bernoulli trials. Find the maximum likelihood estimate of p.
An exponential rate
Eight observations from an exponential distribution add to 20. Find the maximum likelihood estimate of λ.
A variance with a known mean
A sample 8, 12, 9, 11, 10 comes from a normal distribution with known mean 10. Find the maximum likelihood estimate of σ².
A variance with an unknown mean
A sample 2, 4, 6, 8 comes from a normal distribution with unknown mean. Find the maximum likelihood estimate of σ².
A uniform upper limit
The sample 2.1, 4.7, 3.3 comes from a uniform distribution on (0, θ). Find the maximum likelihood estimate of θ.
Method of moments
A uniform distribution on (0, θ) has mean θ/2. The sample mean is 3.2. Find the method of moments estimate of θ.
A log-likelihood value
Ten Bernoulli trials give 7 successes. Evaluate the log-likelihood 7 ln p + 3 ln(1 − p) at p = 0.7.
A likelihood ratio
For the same data (7 successes in 10 trials), how many times as likely are the data at p = 0.7 as at p = 0.5?

Quick questions

1In the likelihood function, which is held fixed?
2Three trials, three successes. The maximum likelihood estimate of p is
3The maximum likelihood estimator of a normal variance, Σ(x − x̄)² ÷ n, is
4The maximum likelihood estimate of σ² is 4. By invariance, the maximum likelihood estimate of σ is
5Neyman's factorisation theorem is used to identify
10
Real questions

Past papers, by level

Standard

Joint tables, standard errors and statement questions, up to JNU and IIT JAM level.

5 questionsPractise →

Delhi School level

This topic’s hardest questions, from the DSE entrance, are worked through in Lesson 13: Estimation and confidence intervals.

6 questionsLesson 13 →
All 5 past-paper questions for this lesson, easiest first: practise the full set →

✦These are questions from the TestStop bank. A free account answers 10 a day, each with its worked solution; All-Access opens every set with no daily limit.

← Lesson 4Estimators: bias, variance, consistency, sufficiencyLesson 6 →Confidence intervals

Read next

All resources →
StatisticsInference 6: confidence intervalsWhat a 95% confidence interval means and does not mean, z and t intervals for a mean, intervals for a proportion and a variance, width and sample size.Complete guide · 50 minStatisticsInference 4: estimators, bias, variance and consistencyWhat makes an estimator good: unbiasedness, efficiency, consistency and sufficiency, mean squared error, and the trade between bias and variance.Complete guide · 45 minStatisticsStatistical inference for economics students, from joint distributions to hypothesis testsA module in thirteen lessons: joint distributions and covariance, sampling and the sampling distribution, the standard error and the central limit theorem, estimators and maximum likelihood, confidence intervals, hypothesis tests and p-values, two-sample tests, chi-square tests, analysis of variance and regression inference, on one running example with labs to move and graded past papers.Module · 635 min