Skip to content
mlmentorship

Maximum likelihood estimation

Compare parameter values using fixed observed data, derive a Bernoulli estimate, and distinguish likelihood, priors, and asymptotic guarantees.

Published · 8 min read ·Core ·Foundation
Reading depth

Summary

Maximum likelihood chooses a parameter that maximizes the probability or density assigned to the observed data. The data stay fixed while candidate parameters vary. For independent observations with a common model ,

The logarithm preserves the maximizer while turning products into sums. For continuous observations, the factors are densities, not probabilities of exact values. Dependent data require their joint or conditional likelihood rather than an unjustified independent product.

For seven successes and three failures under an independent Bernoulli model,

Setting the derivative to zero gives , hence . The second derivative is negative for , so this is the unique maximum for these mixed outcomes. The diagram rescales likelihood by its peak only to make the shape readable.

Learning objective

Hold the observations fixed while comparing candidate probabilities

Keep the data fixed; vary the candidate probabilityFor three successes in five independent trials, likelihood is p^3(1-p)^2. Its maximum occurs at p=3/5, not at a changing data sample.Hold these five observed outcomesfixed10110p=0.2Product: 0.00512p=0.6Product: 0.03456p=0.9Product: 0.00729Multiply successes and failures foreach candidate.
Derivation
Bernoulli likelihood across candidate success probabilities An original diagram starts with ten fixed Bernoulli observations: seven ones and three zeros. For each candidate success probability p, the likelihood is p to the seventh power times one minus p to the third power. A solid relative-likelihood curve rises from zero, reaches its unique maximum at p equals seven tenths, the observed fraction of successes, then returns to zero. A vertical guide and labelled point identify the maximum likelihood estimate. The curve is a score as p varies and is not a probability distribution over p. fixed observations D 1 1 1 1 1 1 1 0 0 0 candidate p → L(p; D) = p⁷(1 − p)³ maximum at p̂ = 7 / 10 = 0.7 1 0.5 0 0 0.5 0.7 1 relative likelihood candidate success probability p
Read it this way: keep the observations fixed while varying p. Seven successes contribute p⁷; three failures contribute (1 − p)³. Their product peaks at 0.7. Relative likelihood is a parameter score, not a normalized parameter distribution.
Check: What changes as the marker moves along the curve? Why is the curve not by itself a posterior distribution over p?
Read it this way: For three successes in five independent trials, likelihood is p^3(1-p)^2. Its maximum occurs at p=3/5, not at a changing data sample.
Why do the two failures penalize the 0.9 candidate?

Properties

Under appropriate identification, sampling, regularity, and existence conditions, MLE can be consistent and asymptotically normal:

Here is Fisher information per observation and must be nonsingular for this expression. Efficiency statements compare regular estimators under their stated asymptotic framework; they do not rule out every pointwise superefficient estimator. Small samples, boundary parameters, growing dimension, or misspecification require separate analysis.

Common cases

ModelMLE solution
Gaussian mean (known )
Gaussian variance (biased; sample-variance uses )
Bernoulli ()
Categoricalempirical class frequencies
Linear regression with independent equal-variance Gaussian noiseLeast squares; the displayed inverse formula needs full column rank
Logistic regressionIterative optimization; complete separation can prevent a finite optimum

Connection to cross-entropy and KL

For categorical and empirical distribution , the negative log-likelihood divided by is

The empirical entropy is constant as model parameters vary, so both objectives select the same optimum. Gaussian regression produces squared-error minimization when its noise-variance and independence assumptions are appropriate.

MLE vs MAP

Add Prior Evidence

New task: Incorporate a declared prior rather than reporting only the likelihood maximizer.

Picture and change: A prior multiplies the Bernoulli likelihood by a factor proportional to . The posterior is .

Check: Its interior mode is , not the MLE ; its mean is .

Use when: Prior assumptions belong in the model. MAP maximizes posterior density in the chosen parameterization; it is not generally invariant under reparameterization. Gaussian and Laplace parameter priors produce quadratic and absolute-value penalties under their specified scales.

Change the Observation Unit

New task: Fit a binomial count of seven successes rather than one particular ordered sequence.

Picture and change: Multiply by to account for compatible sequences.

Check: The factor equals and does not depend on , so the maximizer remains .

Use when: Aggregation changes the recorded observation but preserves the model’s sufficient counts. If dependence changes instead, multiplying independent factors need not be valid.

Common pitfalls

  • Wrong variance denominator. With an unknown Gaussian mean, the variance MLE divides residual squares by . The unbiased sample-variance estimator uses under its assumptions.
  • Missing identification. Parameters producing the same observation distribution need not have unique estimates.
  • Missing existence. All-success Bernoulli data maximize at if the boundary is allowed. Restricting the parameter to leaves only a supremum.
  • Unqualified misspecification claims. Suitable convergence conditions may select a KL-best approximation, not the true data-generating mechanism.

Reconstruct

Is the plotted likelihood a posterior over the parameter?

No. It scores fixed data across parameter values and has not included a prior or normalized over parameters. A constant rescaling preserves the likelihood maximizer; a nonconstant prior can change the posterior mode.