Written and maintained by CASRAI Editorial Board
Published
On this page
What Is Maximum Likelihood Estimation?
Maximum likelihood estimation (MLE) is a method of estimating unknown parameters of a probability distribution by identifying the parameter values that maximize the likelihood of observing the collected sample data. Given an empirical sample drawn from a specified parametric family, the method constructs a likelihood function representing the joint probability density or mass of the observed data as a function of candidate parameters. The parameter vector yielding the highest joint probability is designated as the maximum likelihood estimate. In large samples, maximum likelihood estimators exhibit desirable optimality properties, including asymptotic consistency, asymptotic efficiency (attaining the Cramér-Rao lower bound), and an asymptotic normal distribution that facilitates hypothesis testing and confidence interval construction.
Maximum Likelihood Estimation Formula and Mathematical Framework
The mathematical framework of maximum likelihood estimation connects sample observations to population parameters through calculus and probability theory. Consider a random sample of n independent and identically distributed (i.i.d.) observations, X = (x₁, x₂, …, xₙ), drawn from a probability distribution f(x; θ) indexed by parameter vector θ.
1. Joint Likelihood Function
Under observation independence, the joint probability of obtaining the observed dataset is the product of marginal densities for each individual data point:
L(θ) = ∏_{i=1}ⁿ f(xᵢ; θ)
Where L(θ) represents the joint likelihood, ∏ is the product operator over all n observations, f(xᵢ; θ) is the density or mass of observation xᵢ given parameter θ, and n is sample size.
2. Log-Likelihood Function
Because maximizing a product creates numerical underflow, researchers apply the natural logarithm (ln). Because the logarithm is strictly increasing, parameter values maximizing ln L(θ) also maximize L(θ). The log-likelihood function ℓ(θ) converts the product into an additive sum:
ℓ(θ) = ln L(θ) = ∑_{i=1}ⁿ ln f(xᵢ; θ)
3. Score Function and First-Order Condition
To locate the maximum, calculus is applied by taking the first partial derivative with respect to θ, termed the score function S(θ) = ∂ℓ(θ) / ∂θ = ∑_{i=1}ⁿ [ ∂ ln f(xᵢ; θ) / ∂θ ]. Setting the score function to zero defines the likelihood equation whose solution yields the estimator θ̂: S(θ̂) = 0.
4. Second-Order Condition and Fisher Information
To confirm that θ̂ is a local maximum, the second derivative must be negative definite: ∂²ℓ(θ) / ∂θ² < 0. The negative expected second derivative defines the Fisher Information, I(θ) = – E[∂²ℓ(θ) / ∂θ²]. Evaluating this curvature on sample data gives observed Fisher Information I(θ̂). By the Cramér-Rao theorem, asymptotic variance and standard error are:
Var(θ̂) ≈ 1 / I(θ̂), SE(θ̂) = √[ 1 / I(θ̂) ]
Worked Example: Bernoulli Parameter Estimation
Consider a clinical trial evaluating a rapid assay across n = 100 independent tests, where xᵢ = 1 indicates detection and xᵢ = 0 indicates non-detection. The parameter to estimate is detection probability p (0 < p < 1).
Step 1: Likelihood and Log-Likelihood Formulation
The Bernoulli PMF is f(xᵢ; p) = p^{xᵢ} (1 – p)^{1 – xᵢ}. Across 100 trials with k = ∑ xᵢ = 65 detections and n – k = 35 non-detections, the log-likelihood is:
ℓ(p) = 65 ln(p) + 35 ln(1 – p)
Step 2: Score Equation Solution
Differentiating with respect to p and equating to zero:
∂ℓ(p) / ∂p = (65 / p̂) – (35 / (1 – p̂)) = 0 ⟹ 65(1 – p̂) = 35p̂ ⟹ p̂ = 65 / 100 = 0.6500
Step 3: Curvature, Standard Error, and 95% CI
Evaluating the second derivative at p̂ = 0.65 confirms a maximum:
∂²ℓ(0.65) / ∂p² = – (65 / 0.65²) – (35 / 0.35²) = – 153.8462 – 285.7143 = – 439.5604 < 0
Observed Fisher Information is I(p̂) = 439.5604. Sampling variance and standard error are:
Var(p̂) = 1 / 439.5604 = (0.65 × 0.35) / 100 = 0.002275, SE(p̂) = √0.002275 ≈ 0.0477
The 95% Wald confidence interval is 0.6500 ± (1.96 × 0.0477) = [0.5565, 0.7435]. The maximized log-likelihood is ℓ(0.65) = 65 ln(0.65) + 35 ln(0.35) = -64.7447.
Maximum Likelihood Estimation Examples: Normal and Poisson Distributions
Maximum likelihood estimation extends to multi-parameter continuous distributions and discrete count processes.
Example A: Normal Distribution Mean and Variance
For a normal variable X ~ N(μ, σ²), the joint log-likelihood across n observations is ℓ(μ, σ²) = – (n/2) ln(2π) – (n/2) ln(σ²) – [1 / (2σ²)] ∑(xᵢ – μ)². Setting partial derivatives to zero yields the sample mean μ̂ = (1/n) ∑ xᵢ and MLE variance σ̂² = (1/n) ∑(xᵢ – μ̂)².
Small-Sample Bias Comparison
As documented in NIST Handbook 151 (Section 1.3.6.5.2), σ̂² is biased in finite samples, with expectation E[σ̂²] = ((n – 1) / n) σ². In contrast, unbiased sample variance s² = (1 / (n – 1)) ∑(xᵢ – x̄)² divides by degrees of freedom (n – 1). As n increases, ((n – 1) / n) approaches 1, confirming asymptotic unbiasedness.
Numerical Verification on Five Measurements
For measurements [12.0, 14.0, 15.0, 16.0, 18.0] (n = 5, sum = 75.0, μ̂ = 15.0000):
- Sum of squared deviations: 9 + 1 + 0 + 1 + 9 = 20.0.
- Maximum Likelihood Variance (σ̂²): 20.0 / 5 = 4.0000 (MLE SD σ̂ = 2.0000).
- Unbiased Sample Variance (s²): 20.0 / 4 = 5.0000 (Unbiased SD s ≈ 2.2361).
- Maximized log-likelihood: ℓ(15.0, 4.0) = -2.5 ln(2π) – 2.5 ln(4.0) – (20.0 / 8.0) = -10.5604.
Example B: Poisson Event Count Estimation
For Poisson count data with rate λ > 0, log-likelihood is ℓ(λ) = – nλ + (∑ xᵢ) ln(λ) – ∑ ln(xᵢ!). Differentiating yields ∂ℓ/∂λ = – n + (∑ xᵢ / λ) = 0, proving the MLE rate is the sample mean count λ̂ = (1/n) ∑ xᵢ. For comprehensive modeling details, see our guides on the maximum likelihood estimator of the Poisson distribution and Poisson regression analysis.
Interpretation and Reading Guidance
Interpreting maximum likelihood model outputs involves assessing log-likelihood values, point estimates, standard errors, and fit statistics.
| Output Metric | Statistical Definition | Interpretation Guidance |
|---|---|---|
| Log-Likelihood ln L(θ̂) | Maximized log joint probability density. | Values closer to zero indicate better fit when comparing models fitted to identical data. |
| Point Estimate (θ̂) | Parameter value maximizing sample joint density. | Represents the most plausible population parameter under the assumed distribution family. |
| Standard Error SE(θ̂) | Square root of inverted observed Fisher Information √[I(θ̂)⁻¹]. | Measures estimation uncertainty. Smaller values reflect higher curvature and larger sample sizes. |
| Likelihood Ratio Test (LRT) | Deviance difference: -2 [ln L(θ_reduced) – ln L(θ_full)]. | Follows a χ² distribution with degrees of freedom equal to parameter difference. Preferred over Wald tests for non-linear models. |
| Akaike Criterion (AIC) | Penalized fit metric: AIC = 2k – 2 ln L(θ̂). | Lower values denote superior parsimony, balancing predictive fit against parameter count k. |
Assumptions and Common Mistakes
Valid inference with maximum likelihood estimators requires meeting essential regularity conditions:
- Distribution Specification: The assumed parametric family must realistically capture data distribution. Misspecification directs estimates toward parameters minimizing Kullback-Leibler divergence.
- Observation Independence (i.i.d.): Standard MLE assumes independent observations. For clustered or repeated measures data, standard errors are deflated; researchers should fit a linear mixed model in R.
- Parameter Regularity Conditions: Parameter support must not depend on unknown boundaries (as in Uniform(0, θ)), and parameters must be identifiable.
- Adequate Sample Size: Asymptotic unbiasedness and normality require sufficient sample sizes. Before study launch, assess sample requirements using sample size determination formulas.
Frequent Errors in Practice
- Treating Likelihood as Posterior Probability: Likelihood L(θ | x) is not a probability distribution over θ and does not integrate to 1; it measures data plausibility given fixed parameters.
- Overlooking Finite-Sample Variance Bias: Using σ̂² = (1/n) ∑(xᵢ – μ̂)² instead of Bessel-corrected s² introduces a downward bias of (n – 1) / n in small samples.
- Stopping at Local Maxima: Non-convex likelihood surfaces can trap gradient algorithms in local peaks. Multi-start optimization with varied initial values is essential.
How to Report It (APA Example)
In APA 7th edition formatting, authors report parameter estimates, standard errors, confidence intervals, test statistics (Wald z or χ²), degrees of freedom, exact p-values, and log-likelihood values. Latin letters for sample statistics are italicized (M, SD, N, p, z, SE), whereas Greek letters remain upright (μ, σ, χ², θ).
“A binomial maximum likelihood model was estimated to determine pathogen detection rate across clinical evaluations (N = 100). The maximum likelihood estimate of detection probability was p̂ = .65, SE = .048, 95% CI [.56, .74]. The model achieved a maximized log-likelihood of ln L = -64.74. A Wald test evaluating the parameter against the null chance baseline (p₀ = .50) showed a statistically significant positive effect, z = 3.14, p = .002.”
How to Calculate It in Excel, R, and Python
Maximum likelihood estimation can be executed through analytical formulas when closed-form solutions exist, or through numerical optimization in software packages such as Scikit-Learn logistic regression.
1. Excel (Analytical Formulas and Solver Optimization)
For sample values in cells A2:A6: mean is =AVERAGE(A2:A6), variance MLE is =VAR.P(A2:A6) (divides by n), and SD MLE is =STDEV.P(A2:A6). For Solver optimization: enter log-likelihood in B2 =LN(NORM.DIST(A2, $C$1, $C$2, FALSE)), sum in B7, and maximize $B$7 by changing $C$1:$C$2 with constraint $C$2 >= 0.0001.
2. R (Analytical and Numerical Optimization with optim)
x <- c(12.0, 14.0, 15.0, 16.0, 18.0)
mu_mle <- mean(x); sigma2_mle <- mean((x - mu_mle)^2)
neg_log_lik <- function(params, data) {
mu <- params[1]; sigma <- params[2]
if (sigma <= 0) return(1e10)
-sum(dnorm(data, mean = mu, sd = sigma, log = TRUE))
}
fit <- optim(c(mean(x), sd(x)), neg_log_lik, data = x, method = "L-BFGS-B", lower = c(-Inf, 1e-4), hessian = TRUE)
mle_estimates <- fit$par; std_errors <- sqrt(diag(solve(fit$hessian)))
3. Python (Analytical and Numerical Optimization with SciPy)
import math, numpy as np
from scipy.optimize import minimize
data = np.array([12.0, 14.0, 15.0, 16.0, 18.0])
mu_mle = float(np.mean(data)); sigma2_mle = float(np.mean((data - mu_mle)**2))
def neg_log_lik(p):
if p[1] <= 0: return 1e10
return -np.sum(-0.5 * np.log(2 * np.pi * p[1]**2) - ((data - p[0])**2) / (2 * p[1]**2))
res = minimize(neg_log_lik, [mu_mle, np.std(data)], method="L-BFGS-B", bounds=[(None, None), (1e-4, None)])
mle_mu, mle_sigma = res.x[0], res.x[1]
Frequently Asked Questions
What is maximum likelihood estimation?
Maximum likelihood estimation (MLE) is a statistical method that identifies parameter values of a probability distribution making an observed sample of empirical data most probable. By optimizing a joint likelihood or log-likelihood function, MLE provides consistent point estimates, standard errors, and confidence intervals across statistical models.
Why is the log-likelihood used instead of the raw likelihood?
The natural logarithm transforms products of probabilities into summations of log-probabilities. This simplification facilitates analytic differentiation when solving score equations and prevents floating-point underflow when multiplying many probabilities less than 1. Because the logarithm is strictly increasing, maximizing the log-likelihood yields identical parameter estimates to maximizing raw likelihood.
Is the maximum likelihood estimator always unbiased?
No. While maximum likelihood estimators are asymptotically unbiased as sample size approaches infinity, they can exhibit systematic bias in small samples. For example, the normal distribution variance MLE σ̂² = (1/n) ∑(xᵢ – μ̂)² has an expected value of ((n – 1)/n) σ², underestimating population variance in finite samples compared to unbiased sample variance s².
What is the difference between maximum likelihood estimation and ordinary least squares (OLS)?
Ordinary least squares (OLS) minimizes the sum of squared differences between observed and predicted values without requiring distributional assumptions for the data. In contrast, MLE requires specifying a probability distribution. When regression residuals are normally and independently distributed with constant variance, MLE and OLS produce identical coefficient estimates.
Sources
- NIST/SEMATECH. (2012). e-Handbook of Statistical Methods. National Institute of Standards and Technology (NIST Handbook 151), Section 1.3.6.5.2 (Maximum Likelihood) and Section 8.4.1.2 (Reliability Maximum Likelihood Estimation). Retrieved November 11, 2026, from https://www.itl.nist.gov/div898/handbook/eda/section3/eda3652.htm
- Weisstein, E. W. (2024). Maximum Likelihood. From MathWorld—A Wolfram Web Resource. Retrieved November 11, 2026, from https://mathworld.wolfram.com/MaximumLikelihood.html
- Cole, S. R., Chu, H., & Greenland, S. (2014). Maximum likelihood, profile likelihood, and penalized likelihood: A primer. American Journal of Epidemiology, 179(2), 252–260. PMCID: PMC3873110. Retrieved November 11, 2026, from https://pmc.ncbi.nlm.nih.gov/articles/PMC3873110/







