Quant Memo
Advanced

The Exponential Family

One algebraic template that most named distributions secretly share. Recognise it and you get sufficient statistics, the maximum-likelihood equation, conjugate priors and generalised linear models handed to you for free.

Prerequisites: Maximum Likelihood Estimation (MLE), The Poisson Distribution

Open any statistics textbook and the distributions arrive one at a time, each with its own personality: the binomial has its counting argument, the Poisson its limiting argument, the normal its bell. Each seems to need its own estimation theory, its own Bayesian machinery, its own regression model. Learning them individually is a lot of memorising, and worse, it hides the fact that almost all of them are the same object wearing different clothes. The exponential family is that realisation, written down.

The analogy: the shop only wants your total

Think about a coffee shop loyalty scheme. You buy dozens of things over a year — different drinks, different days, different prices. But when the shop decides what reward you have earned, it does not reread every receipt. It looks at two numbers: how much you spent in total and how many times you visited. Everything else about your year is thrown away, and nothing is lost, because the reward rule only ever depended on those two totals.

A distribution belongs to the exponential family when the same thing is true of its data. However many observations you gather, the distribution only "sees" them through a small fixed set of totals. Those totals are called sufficient statistics, and the whole payoff of the family follows from their existence: if a handful of running sums is all the information there is, then estimation, updating and prediction all become arithmetic on those sums.

The template

A distribution for an observation xx with parameter θ\theta belongs to the exponential family if its probability (or density) can be written as

p(xθ)=h(x)exp(η(θ)T(x)A(η)).p(x \mid \theta) = h(x)\,\exp\big(\eta(\theta)\,T(x) - A(\eta)\big).

Four pieces, each with a job:

  • h(x)h(x), the base measure, is whatever depends on the data alone and not on the parameter. It carries no information about θ\theta.
  • T(x)T(x), the sufficient statistic, is the only function of the data the parameter ever multiplies. This is the loyalty-card total.
  • η(θ)\eta(\theta), the natural parameter, is the parameter re-expressed in whatever units make the formula linear. It is often not the parameter you started with.
  • A(η)A(\eta), the log-partition function, is the bookkeeping term that makes the probabilities sum to one.

In words, the template says: take a data-only factor, multiply the parameter by one summary of the data, exponentiate, and divide by whatever makes it a valid distribution.

one template h(x)·exp( ηT(x) − A(η) ) Bernoulli T(x) = x η = log-odds Poisson T(x) = x η = log λ Normal T(x) = (x, x²) sum and sum of squares Exponential T(x) = x η = −rate
The same skeleton underneath four different-looking distributions. What changes between them is only which summary of the data, T(x), the parameter is allowed to touch.

The one derivation worth doing

Because pp has to integrate to one, the template forces

h(x)eηT(x)dx=eA(η).\int h(x)\, e^{\eta T(x)}\,dx = e^{A(\eta)} .

Differentiate both sides with respect to η\eta. On the left, differentiating eηT(x)e^{\eta T(x)} brings down a factor T(x)T(x); on the right, the chain rule gives A(η)eA(η)A'(\eta)e^{A(\eta)}:

T(x)h(x)eηT(x)dx=A(η)eA(η).\int T(x)\,h(x)\,e^{\eta T(x)}\,dx = A'(\eta)\, e^{A(\eta)} .

Now divide both sides by eA(η)e^{A(\eta)}. The left-hand side becomes T(x)p(xη)dx\int T(x)\,p(x\mid\eta)\,dx, which is just the expected value of TT. So

A(η)=E[T(X)],A(η)=Var(T(X)).A'(\eta) = E[T(X)], \qquad A''(\eta) = \operatorname{Var}(T(X)).

In words: differentiate the bookkeeping term once and you get the mean of the sufficient statistic; differentiate twice and you get its variance. You never have to compute a moment integral for any member of the family again — you differentiate one scalar function.

The same trick gives the estimator. With nn independent observations the log-likelihood is ilnh(xi)+ηiT(xi)nA(η)\sum_i \ln h(x_i) + \eta \sum_i T(x_i) - n A(\eta). Setting its derivative in η\eta to zero leaves iT(xi)nA(η)=0\sum_i T(x_i) - n A'(\eta) = 0, so the maximum-likelihood estimate solves

A(η^)=1ni=1nT(xi).A'(\hat\eta) = \frac{1}{n}\sum_{i=1}^{n} T(x_i).

In words: choose the parameter whose predicted average of TT equals the average of TT you actually observed. Every maximum-likelihood problem in the family is that one sentence.

Worked example 1: the Bernoulli, and where logistic regression comes from

A single coin flip, x{0,1}x \in \{0,1\}, heads with probability pp:

p(xp)=px(1p)1x.p(x \mid p) = p^{x}(1-p)^{1-x}.

Take logs and regroup. lnp(x)=xlnp+(1x)ln(1p)=x(lnpln(1p))+ln(1p)\ln p(x) = x\ln p + (1-x)\ln(1-p) = x\big(\ln p - \ln(1-p)\big) + \ln(1-p). Exponentiating back:

p(xp)=exp(xlnp1p+ln(1p)).p(x\mid p) = \exp\left(x \ln\frac{p}{1-p} + \ln(1-p)\right).

Match it to the template: h(x)=1h(x) = 1, T(x)=xT(x) = x, the natural parameter is η=lnp1p\eta = \ln\frac{p}{1-p} — the log-odds — and A(η)=ln(1p)=ln(1+eη)A(\eta) = -\ln(1-p) = \ln(1+e^{\eta}).

Check it with real numbers at p=0.3p = 0.3:

  • η=ln(0.3/0.7)=ln0.4286=0.847\eta = \ln(0.3/0.7) = \ln 0.4286 = -0.847.
  • A(η)=ln(1+e0.847)=ln(1+0.4286)=ln1.4286=0.357A(\eta) = \ln(1 + e^{-0.847}) = \ln(1 + 0.4286) = \ln 1.4286 = 0.357.
  • A(η)=eη/(1+eη)=0.4286/1.4286=0.300A'(\eta) = e^{\eta}/(1+e^{\eta}) = 0.4286/1.4286 = 0.300. That is the mean of a Bernoulli, pp. Correct.
  • A(η)=p(1p)=0.3×0.7=0.21A''(\eta) = p(1-p) = 0.3 \times 0.7 = 0.21. That is the Bernoulli variance. Correct.

Look at A(η)A'(\eta) again: it is the logistic function. Mapping the natural parameter back to a probability is the logistic curve, which is why Logistic Regression puts a straight line on the log-odds and then squashes it — it is fitting the natural parameter of a Bernoulli, nothing more exotic than that.

The explorer below plots that curve. Set the shape to "logistic", then drag the probe to x=0.85x = -0.85 and read the output: with steepness 1 you land on 0.30, the probability we started from.

Function explorer
-221.1
x = 1.00f(x) = 0.731

Worked example 2: the Poisson, and why its mean equals its variance

Counts of events — trades hitting your quote in a minute, say — with rate λ\lambda:

p(xλ)=eλλxx!=1x!exp(xlnλλ).p(x\mid\lambda) = \frac{e^{-\lambda}\lambda^{x}}{x!} = \frac{1}{x!}\exp\big(x\ln\lambda - \lambda\big).

Match the template: h(x)=1/x!h(x) = 1/x!, T(x)=xT(x) = x, η=lnλ\eta = \ln\lambda, and since λ=eη\lambda = e^{\eta}, the log-partition is A(η)=eηA(\eta) = e^{\eta}.

Now differentiate. A(η)=eη=λA'(\eta) = e^{\eta} = \lambda and A(η)=eη=λA''(\eta) = e^{\eta} = \lambda as well, because eηe^\eta is its own derivative. The mean and the variance are the same function, so for a Poisson they are the same number — a fact usually presented as a curiosity, here forced by one line of calculus.

Fit it to data. Five one-minute trade counts: 3,5,2,6,43, 5, 2, 6, 4. Their sum is 20 and n=5n = 5, so the average of TT is 20/5=420/5 = 4. The estimating equation says A(η^)=4A'(\hat\eta) = 4, that is eη^=4e^{\hat\eta} = 4, so η^=ln4=1.386\hat\eta = \ln 4 = 1.386 and λ^=4\hat\lambda = 4.

Notice what you needed: the total, 20, and the count, 5. The individual numbers 3, 5, 2, 6, 4 never entered. That is sufficiency doing real work — a monitoring system can keep two running numbers and refit exactly.

The explorer below shows the fitted distribution. Drag λ\lambda to 4 and note that the spread grows in lockstep with the centre, exactly as A=AA'' = A' requires.

Distribution · poisson
mean 4.0024681012outcomes (k) →
mean 4.00std dev 2.00peak at k = 3

What this means in practice

  • Generalised linear models. Logistic regression, Poisson regression and ordinary least squares are one idea: put a linear model on the natural parameter of an exponential-family response. Choosing "the right model for count data" is choosing TT and η\eta.
  • Bayesian updating that costs nothing. Conjugate priors exist precisely for exponential families, so a posterior update is addition on sufficient statistics. See Conjugate Priors.
  • Streaming and aggregation. Sufficiency means a system can store totals rather than history. Ten years of tick counts collapse to two numbers with no loss.
  • Curvature is information. A(η)A''(\eta) is both the variance and the Fisher information, which is why a flat log-partition means a poorly identified parameter.
  • Where it fails. Mixtures, and heavy-tailed models such as Student's t, are not in the family. Their tails cannot be captured by a fixed finite set of totals, which is exactly why fat-tailed estimation is harder.

An exponential-family distribution touches the data only through a fixed summary T(x)T(x). Everything else follows: the maximum-likelihood equation is "match the observed average of TT", and the mean and variance of TT are the first and second derivatives of the single scalar function A(η)A(\eta).

Three traps, in the order people fall into them. First, the name: the "exponential family" is a class of distributions; the "exponential distribution" is one member of it. Second, the parameter: η\eta is almost never the parameter you were handed. For a Bernoulli it is the log-odds, not pp; for a Poisson it is lnλ\ln\lambda, not λ\lambda. Differentiating AA with respect to the wrong one gives nonsense. Third, the support: if the set of possible values depends on the parameter — a uniform on 00 to θ\theta, for instance — the distribution is not in the family, no matter how it is rewritten, and none of the results above apply.

Related concepts

Practice in interviews

Further reading

  • Casella & Berger, Statistical Inference (ch. 3)
  • Wasserman, All of Statistics (ch. 9)
  • McCullagh & Nelder, Generalized Linear Models (ch. 2)
ShareTwitterLinkedIn