- P(y | ΞΈ): Probability of data y when parameter ΞΈ is known. ΞΈ fixed, y unknown.
- L(ΞΈ | y): Likelihood of parameter ΞΈ when data y are observed. y fixed, ΞΈ unknown.
Same mathematical formula β completely different interpretation.
Likelihood does not sum to 1 and is not a probability over ΞΈ. For continuous distributions L is the density value β which can exceed 1 (set Ο very small in Stage 2 to see the density curve rise above 1).
The likelihood of n observations is the product of individual densities:
L(ΞΈ|yββ¦yβ) = βα΅’ f(yα΅’|ΞΈ)
With many small values (e.g. 0.04 Γ 0.09 Γ β¦ Γ 0.06) the product becomes extremely small β numerical underflow. Stage 2 shows this live: the product of the red lines is displayed in the info text and shrinks rapidly.
The logarithm converts the product into a sum:
β(ΞΈ) = Ξ£α΅’ log f(yα΅’|ΞΈ) β it is a monotonically increasing function,
so the maximum lies at exactly the same point ΞΈ
whether you maximize L(ΞΈ) or β(ΞΈ).
The key practical advantage: instead of multiplying thousands of tiny numbers together (numerical underflow β the computer simply returns 0), you now add manageable negative numbers, with no loss of precision. MLE therefore always maximizes β(ΞΈ) = log L(ΞΈ).
Maximum Likelihood Estimation finds ΞΈ that makes the observed data
most plausible: ΞΈ = argmax β(ΞΈ|y)
This is not a verdict about ΞΈ itself β only about its compatibility with the data. Other ΞΈ values are not impossible, just less plausible.
Analytical MLE estimators (Normal):
ΞΌ =
ΟΒ² = Ξ£(yα΅’β)Β²/n
Why is ΟΒ² biased? The estimator centers on
itself, and is, by
construction, exactly the value that minimizes Ξ£(yα΅’βc)Β² over all possible c
(the least-squares property of the mean). That makes Ξ£(yα΅’β)Β²
smaller on average than Ξ£(yα΅’βΞΌ)Β² with the true ΞΌ. Exactly:
E[ΟΒ²] = (nβ1)/n Β· ΟΒ² β the effect is
strongest for small n. The unbiased estimator
sΒ² = Ξ£(yα΅’β)Β²/(nβ1) corrects for this
(Bessel's correction) β that's why R's var() divides by nβ1.
In Stage 1: ΞΌ = y (one point). In Stage 2: ΞΌ = (all points).
MLE can estimate multiple parameters simultaneously β a key advantage over simple moment estimators.
For the Normal distribution there are two unknown parameters: ΞΌ (location)
and Ο (spread). The log-likelihood becomes a surface over the (ΞΌ, Ο)-space β
a mountain landscape instead of a curve. The joint MLE lies at the peak:
ΞΌ =
Ο = β(Ξ£(yα΅’β)Β²/n)
In Stage 2: activate "Vary Ο too" β the heatmap shows the 2D landscape, the bright spot is the joint peak. This principle scales to arbitrarily many parameters β this is how lm() and glm() in R work internally.
MLE works for any parametric family β not just Normal. This is the foundation of GLMs:
- Poisson (training hours/week):
Ξ» =| Log-likelihood:Ξ£α΅’ [yα΅’Β·log(Ξ») β Ξ»] - Bernoulli (min. performance 0/1):
p = proportion of ones| Log-likelihood:Ξ£α΅’ [yα΅’Β·log(p) + (1βyα΅’)Β·log(1βp)]
Switch between families in Stage 3: the likelihood landscape changes its shape β parabola for Bernoulli, asymmetric for Poisson β but the mechanism is identical: find the peak.
The maximized log-likelihood value βΜ can be used directly for model comparison:
AIC = β2Β·βΜ + 2k(k = number of parameters)BIC = β2Β·βΜ + kΒ·log(n)
Smaller AIC/BIC = better fit at equal complexity. AIC penalizes less strongly than BIC β with large n, BIC favors more parsimonious models.
Important caveat: AIC/BIC are directly comparable only between models of the same distributional class β e.g. several count-data models (Poisson vs. Negative-Binomial) or several normal models. Between fundamentally different families (e.g. Bernoulli vs. Normal), the values are not comparable without further adjustment, since they rest on different data scales/likelihood normalizations.
Application example: Does Poisson or Negative-Binomial fit the training-hours data better? Same data, same distributional class (count data) β here AIC/BIC decide. In Stage 3, both are computed live.