Skip to content

Statistical Decision Theory

Every machine learning system is a decision procedure: it maps data to an action; a prediction, a class label, a price. Decision theory is the framework that says what “good” means, and the framework’s honesty is its value: a loss function must be chosen, and the choice is a statement about consequences, not a property of the algorithm. Accuracy, squared error, cross-entropy; these are different losses, they rank different procedures differently, and no theorem declares one correct.

This page sets up the framework and proves its first theorems. The prerequisite is measure-theoretic probability: expectation is a Lebesgue integral, and “risk” will be an integral against the joint law of data and parameter.

A doctor chooses a treatment from a test result. Two errors are possible - treat a healthy patient, withhold from a sick one; and they are not equally bad. Decision theory formalises this: a loss function prices each (truth, action) pair, the risk of a procedure is the expected loss, and the question “which procedure should I use” becomes “which has the smallest risk”; which is a well-posed question with a unique answer once the loss and the data-generating law are fixed.

The subtlety is that the data-generating law depends on the unknown parameter. So risk depends on θ\theta, and two procedures can each be better than the other for some θ\theta. Every classical statistician’s dilemma; which estimator?; is this non-comparability, and the two classical escapes (Bayes: average over θ\theta with a prior; minimax: take the worst case) are the two philosophies of the subject, both defined on this page.

Definition. A decision problem consists of:

  • a parameter space Θ\Theta with true parameter θ0\theta_0;
  • data X∼pθX \sim p_\theta for some θ∈Θ\theta \in \Theta;
  • an action space A\mathcal{A} of allowed decisions;
  • a loss function L(θ,a)≥0L(\theta, a) \geq 0 pricing action aa when the truth is θ\theta;
  • a decision rule δ:X→A\delta : \mathcal{X} \to \mathcal{A} mapping data to actions.

Definition. The risk of δ\delta at θ\theta is

R(θ,δ)=Eθ[L(θ,δ(X))]=∫XL(θ,δ(x)) pθ(x) dx,R(\theta, \delta) = \mathbb{E}_\theta\big[L(\theta, \delta(X))\big] = \int_{\mathcal{X}} L(\theta, \delta(x))\, p_\theta(x)\, dx,

an integral against the law of the data at that θ\theta.

Standard losses. For estimation problems (A=Θ\mathcal{A} = \Theta):

  • squared error L(θ,a)=(a−θ)2L(\theta, a) = (a - \theta)^2, giving risk = mean squared error;
  • absolute error L=∣a−θ∣L = |a - \theta|, whose optimum point estimate is the median (proved below);
  • zero–one L=1(a≠θ)L = \mathbf{1}(a \neq \theta), giving risk = error probability - the loss of classification.

Proposition (optimal point action under each loss). For a known distribution of XX under prior π\pi, the action minimising posterior expected loss is the posterior mean under squared error, the posterior median under absolute error, and the posterior mode under zero–one loss.

Proof for squared error. Minimise g(a)=E[(a−θ)2∣X]=a2−2a E[θ∣X]+E[θ2∣X]g(a) = \mathbb{E}[(a - \theta)^2 \mid X] = a^2 - 2a\,\mathbb{E}[\theta \mid X] + \mathbb{E}[\theta^2 \mid X]. Differentiate in aa: g′(a)=2a−2E[θ∣X]=0g'(a) = 2a - 2\mathbb{E}[\theta \mid X] = 0 gives a=E[θ∣X]a = \mathbb{E}[\theta \mid X], and g′′(a)=2>0g''(a) = 2 > 0 confirms a minimum. ■\blacksquare

Proof for absolute error. Minimise g(a)=E[∣a−θ∣∣X]g(a) = \mathbb{E}[|a - \theta| \mid X]. Write g(a)=∫−∞a(a−θ) π(θ∣X) dθ+∫a∞(θ−a) π(θ∣X) dθg(a) = \int_{-\infty}^a (a - \theta)\,\pi(\theta \mid X)\,d\theta + \int_a^\infty (\theta - a)\,\pi(\theta \mid X)\,d\theta. Differentiating under the integral; both integrands vanish at θ=a\theta = a, so the boundary terms are zero; gives g′(a)=F(a)−(1−F(a))=2F(a)−1g'(a) = F(a) - (1 - F(a)) = 2F(a) - 1 where FF is the posterior CDF. Setting g′(a)=0g'(a) = 0 gives F(a)=1/2F(a) = 1/2: the median. Since g′′=2π(a∣X)≥0g'' = 2\pi(a \mid X) \geq 0, this is a minimum. ■\blacksquare

That median proof is worth reading twice: the boundary terms vanish because the absolute value’s integrand is zero at θ=a\theta = a, and the derivative lands on the posterior CDF. “Regression to the mean” and “classification to the mode” are the same theorem with different losses.

Definition. Given a prior density π(θ)\pi(\theta), the Bayes risk of δ\delta is r(π,δ)=Eπ[R(θ,δ)]r(\pi, \delta) = \mathbb{E}_\pi[R(\theta, \delta)]; the risk averaged over the prior. A Bayes rule minimises it.

Theorem (Bayes rule via posterior expected loss). A rule minimising the posterior expected loss E[ L(θ,δ(X))∣X ]\mathbb{E}[\,L(\theta, \delta(X)) \mid X\,] for each XX separately minimises the Bayes risk; and for squared error the Bayes rule is the posterior mean.

Proof. By Fubini’s theorem; applicable since L≥0L \geq 0; the Bayes risk is an iterated integral:

r(π,δ)=∫X[∫ΘL(θ,δ(x)) π(θ∣x) dθ]m(x) dx,r(\pi, \delta) = \int_{\mathcal{X}} \left[\int_\Theta L(\theta, \delta(x))\, \pi(\theta \mid x)\,d\theta\right] m(x)\, dx,

where m(x)=∫pθ(x) π(θ) dθm(x) = \int p_\theta(x)\,\pi(\theta)\,d\theta is the marginal density of the data and π(θ∣x)=pθ(x)π(θ)/m(x)\pi(\theta \mid x) = p_\theta(x)\pi(\theta)/m(x) is the posterior by Bayes’ theorem. The inner bracket is the posterior expected loss, a non-negative function of xx alone. An integral of a non-negative function is minimised by minimising the function pointwise wherever possible; so a rule that picks the minimising action for each xx minimises the whole. For squared error, §1 identifies that action as the posterior mean. ■\blacksquare

Fubini is doing real work: it licenses splitting “average over XX then θ\theta” into “for each XX, optimise, then average the optimum”. That is the mathematical statement that the Bayesian can decide locally, given the data, without thinking about data they did not see.

Worked example (Bernoulli, Beta prior). X∼Binomial(n,θ)X \sim \mathrm{Binomial}(n, \theta), prior θ∼Beta(α,β)\theta \sim \mathrm{Beta}(\alpha, \beta), squared-error loss. The posterior is Beta(α+x,β+n−x)\mathrm{Beta}(\alpha + x, \beta + n - x) by conjugacy, so the Bayes rule is

δ(x)=α+xα+β+n.\delta(x) = \frac{\alpha + x}{\alpha + \beta + n}.

With α=β=1\alpha = \beta = 1 (uniform prior) this is (x+1)/(n+2)(x+1)/(n+2); Laplace’s rule of succession, which shrinks the empirical frequency toward 1/21/2 by exactly one pseudo-observation on each side. The prior is not an opinion injected into the answer; it is a term in the risk computation.

Definition. δMM\delta^{\mathrm{MM}} is minimax if it minimises sup⁡θR(θ,δ)\sup_\theta R(\theta, \delta) over all rules.

Minimax replaces the prior’s average with the adversary’s worst case. The two philosophies differ in what “unknown θ\theta” licenses: the Bayesian says a prior encodes knowledge; the minimaxer says no assumption should be made. Their answers can differ sharply; and both are rules whose risk profiles can be computed and compared.

Theorem (minimax–Bayes connection). If a Bayes rule for prior π\pi has constant risk R(θ,δ)=rR(\theta, \delta) = r for all θ\theta, then δ\delta is minimax, with sup⁡θR(θ,δ)=r\sup_\theta R(\theta,\delta) = r.

Proof. For any rule δ′\delta', sup⁡θR(θ,δ′)≥∫R(θ,δ′) π(θ) dθ=r(π,δ′)≥r(π,δ)=r\sup_\theta R(\theta, \delta') \geq \int R(\theta, \delta')\,\pi(\theta)\,d\theta = r(\pi, \delta') \geq r(\pi, \delta) = r, since a non-negative weighted average cannot exceed the supremum and δ\delta minimises the Bayes risk. So no rule beats rr in the worst case, and δ\delta attains it. ■\blacksquare

The proof is three inequalities, but the conclusion is the workhorse of the subject: to prove an estimator minimax, find a prior under which its risk is constant. That is how the sample mean is proved minimax for the normal mean, and how minimax results are usually obtained; not by solving worst cases directly, but by exhibiting a least-favourable prior.

Definition. δ\delta is inadmissible if some δ′\delta' has R(θ,δ′)≤R(θ,δ)R(\theta, \delta') \leq R(\theta, \delta) for all θ\theta with strict inequality for at least one; otherwise admissible.

Theorem (Bayes rules are admissible, under conditions). If the Bayes risk is finite, the prior has full support, and R(θ,δ)R(\theta, \delta) is continuous in θ\theta for every rule in play, then a unique Bayes rule is admissible.

Proof sketch. If δ′\delta' dominated the Bayes rule δ\delta, then integrating against a prior of full support with continuous risk gives r(π,δ′)<r(π,δ)r(\pi, \delta') < r(\pi, \delta); strictness survives integration because the strict inequality holds on a set of positive prior mass and continuity spreads it to a neighbourhood; contradicting that δ\delta minimises the Bayes risk. ■\blacksquare

Admissibility is a weak virtue; an inadmissible rule should never be used, but admissible rules can still be terrible; and the theorem’s value is directional: to show a rule is admissible, exhibit it as a Bayes rule. The pathology is famous and worth naming: for n≥3n \geq 3 dimensions, the ordinary sample mean is inadmissible under squared error; the James–Stein estimator dominates it. “The obvious estimator” is provably beaten, everywhere, in three or more dimensions.

4. Sufficiency: compressing data without loss

Section titled “4. Sufficiency: compressing data without loss”

Definition. A statistic T(X)T(X) is sufficient for θ\theta if the law of the data given TT is independent of θ\theta: pθ(x∣T(x))p_\theta(x \mid T(x)) does not involve θ\theta.

A sufficient statistic is a lossless compression: everything in the data that bears on θ\theta is in TT, and the rest is noise that no rule can use.

Theorem (Neyman factorisation). TT is sufficient iff the density factorises as

pθ(x)=g(T(x),θ)  h(x),p_\theta(x) = g(T(x), \theta)\;h(x),

for functions gg and hh with hh independent of θ\theta.

Proof. (⇐\Leftarrow) If pθ(x)=g(T(x),θ)h(x)p_\theta(x) = g(T(x),\theta)h(x), then the conditional density of XX given T=tT = t is

pθ(x∣T=t)=pθ(x)Pθ(T=t)=g(t,θ)h(x)g(t,θ) η(t)=h(x)η(t),p_\theta(x \mid T = t) = \frac{p_\theta(x)}{P_\theta(T = t)} = \frac{g(t,\theta)h(x)}{g(t,\theta)\,\eta(t)} = \frac{h(x)}{\eta(t)},

using that the law of TT has density proportional to g(t,θ)η(t)g(t,\theta)\eta(t) where η(t)=∫T=th\eta(t) = \int_{T = t} h is θ\theta-free. The θ\theta-dependence cancels, so the conditional law does not involve θ\theta: TT is sufficient. (For discrete XX this is exact; for continuous XX the same argument runs with the co-area measure on the level set {T=t}\{T = t\}.)

(⇒\Rightarrow) If TT is sufficient, pθ(x)=pθ(T(x)) p(x∣T(x))p_\theta(x) = p_\theta(T(x))\, p(x \mid T(x)) by the definition of conditional density, which is the factorisation with g=pθ(T(x))g = p_\theta(T(x)) and h=p(x∣T(x))h = p(x \mid T(x)), the latter θ\theta-free by sufficiency. ■\blacksquare

Worked example. For X1,…,XnX_1, \dots, X_n i.i.d. Poisson(λ)\mathrm{Poisson}(\lambda),

pθ(x)=∏ie−λλxixi!=e−nλ λ∑xi ∏i1xi!,p_\theta(x) = \prod_i e^{-\lambda}\frac{\lambda^{x_i}}{x_i!} = e^{-n\lambda}\,\lambda^{\sum x_i}\,\prod_i \frac{1}{x_i!},

which is g(∑xi,λ) h(x)g(\sum x_i, \lambda)\,h(x) with g=e−nλλ∑xig = e^{-n\lambda}\lambda^{\sum x_i} and h=∏1/xi!h = \prod 1/x_i!. So ∑iXi\sum_i X_i is sufficient for λ\lambda; the whole sample collapses to its sum with no loss about λ\lambda. Every estimator that uses anything beyond the sum is using noise.

Definition. A family with densities

pθ(x)=h(x) exp⁡(η(θ)⋅T(x)−A(θ))p_\theta(x) = h(x)\,\exp\big(\eta(\theta)\cdot T(x) - A(\theta)\big)

is a kk-parameter exponential family, with natural parameter η(θ)∈Rk\eta(\theta) \in \mathbb{R}^k, sufficient statistic T(x)T(x), and log-partition function A(θ)A(\theta).

Exponential families are the ones with finite-dimensional sufficient statistics: TT is a vector of fixed length regardless of sample size. That is why the normal family needs only (∑xi,∑xi2)(\sum x_i, \sum x_i^2), why a Bernoulli sample collapses to its count, and why a Cauchy sample cannot be compressed - the Cauchy family is not exponential, and its sufficient statistic is the whole ordered sample.

Proposition. A(η)=log⁡∫h(x)eη⋅T(x)dxA(\eta) = \log\int h(x)e^{\eta\cdot T(x)}dx is the cumulant-generating function of TT: ∇ηA=Eθ[T]\nabla_\eta A = \mathbb{E}_\theta[T] and ∇η2A=Cov⁡θ(T)\nabla^2_\eta A = \operatorname{Cov}_\theta(T).

Proof. Differentiate under the integral sign:

∇ηA=1Z∫T(x) h(x)eη⋅T(x)dx=Eθ[T],\nabla_\eta A = \frac{1}{Z}\int T(x)\,h(x)e^{\eta\cdot T(x)}dx = \mathbb{E}_\theta[T],

where Z=∫heη⋅TZ = \int h e^{\eta\cdot T} and the passage of the gradient through the integral is licensed by dominated convergence on compacts of η\eta (the exponential family’s natural space is exactly where ZZ is finite). Differentiate again:

∇η2A=1Z∫TT ⁣⊤heη⋅Tdx−(1Z∫T heη⋅Tdx)(1Z∫T heη⋅Tdx) ⁣⊤=Eθ[TT ⁣⊤]−Eθ[T] Eθ[T] ⁣⊤,\nabla^2_\eta A = \frac{1}{Z}\int T T^{\!\top} h e^{\eta\cdot T}dx - \Big(\frac{1}{Z}\int T\,h e^{\eta\cdot T}dx\Big)\Big(\frac{1}{Z}\int T\,h e^{\eta\cdot T}dx\Big)^{\!\top} = \mathbb{E}_\theta[TT^{\!\top}] - \mathbb{E}_\theta[T]\,\mathbb{E}_\theta[T]^{\!\top},

which is the covariance. ■\blacksquare

That ∇2A\nabla^2 A is a covariance; hence positive semi-definite; is the same statement as ”AA is convex”, which is the fact the variational-inference page will use to make its optimisation well posed. The page is written so that this one proposition does the work twice.

Conjugacy as closure. For a Bernoulli likelihood with Beta prior, the posterior is again Beta: the prior is conjugate. In exponential-family language, conjugacy holds because the prior can be written in the same exp⁡(η⋅T−A)\exp(\eta\cdot T - A) form with respect to the same statistic TT; Bayes’ rule multiplies pθ(x)π(θ)p_\theta(x)\pi(\theta), and multiplying two exponential-family forms in TT adds their natural parameters. Conjugacy is not a lucky algebraic accident; it is closure of the family under the sampling operation.

Python; the Beta–Bernoulli Bayes rule and its risk curve.

import numpy as np
rng = np.random.default_rng(2026)
n, theta_true = 64, 0.3
alpha0, beta0 = 1, 1
x = rng.binomial(n, theta_true)
post_mean = (alpha0 + x) / (alpha0 + beta0 + n)
mle = x / n
print(f"x = {x}/{n} MLE = {mle:.4f} Bayes = {post_mean:.4f}")
# Risk curves: MC estimate of R(theta, delta) = E[(delta(X) - theta)^2].
# For the Beta-Bernoulli model the Bayes risk is available in closed form:
# r = E[ Var(theta|X) ] and the posterior variance of a Beta is
# ab/((a+b)^2 (a+b+1)) evaluated at the random (a+x, b+n-x).
thetas = rng.beta(2, 3, size=200_000) # a different prior for the risk
risks_bayes, risks_mle = np.empty(200_000), np.empty(200_000)
for i, th in enumerate(thetas):
xs = rng.binomial(n, th, size=400)
post_a, post_b = alpha0 + xs, beta0 + n - xs
d_bayes = post_a / (post_a + post_b)
d_mle = xs / n
risks_bayes[i] = np.mean((d_bayes - th) ** 2)
risks_mle[i] = np.mean((d_mle - th) ** 2)
print(f"sup risk: Bayes {risks_bayes.max():.5f} MLE {risks_mle.max():.5f}")
print(f"mean risk: Bayes {risks_bayes.mean():.5f} MLE {risks_mle.mean():.5f}")

Expected output: the Bayes rule’s mean risk over the (2,3)(2,3) prior beats the MLE’s, while the MLE’s worst-case risk is lower near θ=0.5\theta = 0.5; the two philosophies of §2 and §3 visible in one printout, each optimal for its own criterion.

R; the risk curve as a picture.

set.seed(2026)
thetas <- seq(0.05, 0.95, by = 0.01)
n <- 32; a0 <- b0 <- 1
risk_bayes <- risk_mle <- numeric(length(thetas))
for (i in seq_along(thetas)) {
xs <- rbinom(2000, n, thetas[i])
d_b <- (a0 + xs) / (a0 + b0 + n) # Bayes rule (posterior mean)
d_m <- xs / n # MLE
risk_bayes[i] <- mean((d_b - thetas[i])^2)
risk_mle[i] <- mean((d_m - thetas[i])^2)
}
plot(thetas, risk_mle, type = "l", col = "gray40", ylab = "risk", xlab = "theta")
lines(thetas, risk_bayes, col = "firebrick")
legend("topleft", c("MLE", "Bayes (Beta(1,1) rule)"),
col = c("gray40", "firebrick"), lty = 1)

The plot shows the curves crossing: the Bayes rule wins near the prior’s mass and loses near the tails; no rule dominates, which is the non-comparability of §2, drawn.

  • Treating the loss as given. It is chosen, and different losses give different optimal actions: mean, median, mode. Reporting an average and calling it “the answer” has already assumed squared error.
  • Confusing Bayes risk with risk. R(θ,δ)R(\theta, \delta) is a function of the unknown θ\theta; r(π,δ)r(\pi, \delta) is a number. A Bayes rule minimises the second; its first can be terrible at some θ\theta.
  • Assuming admissibility means good. It only means not dominated. Weakly admissible procedures can be arbitrarily bad; the theorem’s use is to rule things out.
  • Using E[XY]=EXEY\mathbb{E}[XY] = \mathbb{E}X\mathbb{E}Y without independence, and equally, using independence without stating it in the model. Page 1’s warning is repeated because risk computations fail on it.
  • Computing sufficiency from the likelihood’s value rather than its shape. Sufficiency is about how θ\theta enters the density, not about the number it evaluates to; read the factorisation, not the output.