STAT 536 — Statistical Computing
Fall 2026
where \(X\): the number of heads in 10 flips; \(\theta\): the probability of heads; the semicolon in \(L(\theta; X)\) separates the argument we optimize over from the fixed data.
| Symbol | Name | Meaning | What varies | What is fixed |
|---|---|---|---|---|
| \(p(X \mid \theta)\) | probability | probability of the data given the parameter | \(X\) (random) | \(\theta\) (known) |
| \(L(\theta; X)\) | likelihood | support for the parameter given the data | \(\theta\) (unknown) | \(X\) (observed) |
| \(\ell(\theta; X) = \log L(\theta; X)\) | log-likelihood | log of the likelihood | \(\theta\) (unknown) | \(X\) (observed) |
For independent data, \(L(\theta; X) = \prod_i p(x_i \mid \theta)\) and \(\ell(\theta; X) = \sum_i \log p(x_i \mid \theta)\).
| Products, \(L\) | Sums, \(\ell\) |
|---|---|
| a product of many small probabilities | a sum, with no numerical trouble |
| \((0.01)^{1000} = 10^{-2000}\) underflows: a computer cannot store it | \(1000\log(0.01) \approx -4605\) |
| messy derivatives | clean derivatives |
where \(x_i\): the \(i\)th observation.
where \(\mu\), \(\sigma^2\): the mean and the variance; \(n\): the sample size; \(\bar x\): the sample mean.
| Field | Incomplete information |
|---|---|
| Economics and finance | asset returns partially observed; default status unknown for some borrowers; customer types unobserved |
| Political science | survey non-response; hidden ideologies behind legislative votes; unobserved negotiations in coalition formation |
| Computer science | pixel labels unknown in image segmentation; missing ratings in recommender systems; hidden topics in documents |
| Statistics | component membership in mixture models; censored survival times; latent factors in factor analysis |
where \(x_i\): the spending and visit frequency of customer \(i\); \(z_i\): its segment.
where the integral is a sum when \(Z\) is discrete; \(\ell_c = \log L_c\) and \(\ell = \log L\).
\[\frac{\partial}{\partial\theta}\,\ell(\theta; X) = \frac{\int \frac{\partial}{\partial\theta}\, p(X, Z \mid \theta)\,dZ}{\int p(X, Z \mid \theta)\,dZ}\]
where \(p(X, Z \mid \theta)\): the joint density of the observed and latent data; both integrals are over \(Z\).
where \(\lambda\): the weight on \(x\) in the average \(\lambda x + (1 - \lambda)y\).
Theorem (Jensen)
If \(f\) is convex, \(f(\E[X]) \le \E[f(X)]\). If \(f\) is concave, \(f(\E[X]) \ge \E[f(X)]\). If \(f\) is strictly convex or strictly concave, equality holds only when \(X\) is constant.
where \(X\): a random variable with a finite mean (positive, for the \(\log\) question below).
For any distribution \(q(Z)\) of the latent data, positive wherever \(p(X, Z \mid \theta)\) is, \[\ell(\theta; X) = \log\int \frac{p(X, Z \mid \theta)}{q(Z)}\,q(Z)\,dZ = \log\E_q\Bigl[\frac{p(X, Z \mid \theta)}{q(Z)}\Bigr] \ge \E_q\Bigl[\log\frac{p(X, Z \mid \theta)}{q(Z)}\Bigr] = \mathcal{L}(q, \theta).\]
where \(p(X, Z \mid \theta)\): the joint density of the observed and latent data; \(\E_q\): the expectation over \(Z\) distributed as \(q\).
Key result
The bound touches \(\ell(\theta; X)\) exactly when \(q\) is the posterior of \(Z\) at \(\theta\).
where \(c\): a constant, free of \(Z\); \(p(Z \mid X, \theta)\): the conditional distribution of the latent data given the observed data.
where \(p_1\), \(p_2\): the probabilities of two independent events, so \(p_1 p_2\) is the probability that both happen.
where \(p(x)\): the probability that \(X = x\).
| Outcome | Probability | Codeword | Length | \(-\log_2 p\) |
|---|---|---|---|---|
| A | 1/2 | 0 | 1 | 1 |
| B | 1/4 | 10 | 2 | 2 |
| C | 1/8 | 110 | 3 | 3 |
| D | 1/8 | 111 | 3 | 3 |
Theorem (Shannon, 1948)
No prefix code uses fewer than \(H(X)\) bits per outcome on average, and some prefix code uses fewer than \(H(X) + 1\). Coding blocks of \(n\) independent outcomes at once brings the average below \(H(X) + 1/n\) bits per outcome.
where \(H(X)\): the entropy of the outcome, in bits; prefix code: no codeword begins another.
where \(l(x)\): the length of the codeword for \(x\); \(p\), \(q\): the probabilities under \(P\) and \(Q\); \(\E_P\): the expectation with \(X\) distributed as \(P\).
\[\mathrm{KL}(P \,\|\, Q) = H(P, Q) - H(P) = \sum_x p(x)\log_2\frac{p(x)}{q(x)}\]
where \(H(P, Q)\): the cross-entropy; \(H(P)\): the entropy of \(P\); \(p\), \(q\): the probabilities under \(P\) and \(Q\).
where \(Q_\theta\): the model distribution, with density \(q_\theta(x) = p(x \mid \theta)\); \(x_1, \ldots, x_n\): independent draws from \(P\); \(H\) and \(\mathrm{KL}\) in nats here, since \(\ell\) uses the natural logarithm (for continuous data \(H(P)\) is the differential entropy); the limit is the law of large numbers.
| Divergence | Definition | Properties |
|---|---|---|
| total variation | \(\frac12\int\lvert p(x) - q(x)\rvert\,dx\) | the largest difference in the probability of an event; symmetric, a distance |
| squared Hellinger | \(\frac12\int\bigl(\sqrt{p(x)} - \sqrt{q(x)}\bigr)^2dx\) | symmetric, between 0 and 1; its square root is a distance |
| \(\chi^2\) | \(\int (p(x) - q(x))^2/q(x)\,dx\) | asymmetric; Pearson’s goodness-of-fit statistic is \(n\) times it, with \(p\) the observed proportions and \(q\) the model’s |
where \(p\), \(q\): the densities of \(P\) and \(Q\).
\[\mathrm{KL}(P \,\|\, Q) = \int p(x)\log\frac{p(x)}{q(x)}\,dx = \E_P\Bigl[\log\frac{p(X)}{q(X)}\Bigr]\]
where \(p\), \(q\): the densities of \(P\) and \(Q\); \(\E_P\): the expectation with \(X\) distributed as \(P\); \(\log\): the natural logarithm, so KL is in nats (divide by \(\log 2\) for bits).
| Properties | Readings |
|---|---|
| \(\mathrm{KL}(P \,\Vert\, Q) \ge 0\) | the expected log-ratio of the densities under \(P\) |
| \(\mathrm{KL}(P \,\Vert\, Q) = 0\) if and only if \(P = Q\) | the information lost when \(Q\) approximates \(P\) |
| asymmetric, so not a distance | the extra nats (bits, with \(\log_2\)) needed to encode samples from \(P\) with a code built for \(Q\) |
| convex in the pair \((P, Q)\) |
Theorem (Gibbs’ inequality)
\(\mathrm{KL}(P \,\|\, Q) \ge 0\), with equality if and only if \(P = Q\).
where \(p\), \(q\): the densities (or probabilities) of \(P\) and \(Q\); the integral runs over the values where \(p > 0\).
where \(\mu_1, \mu_2\): the means; \(\sigma_1^2, \sigma_2^2\): the variances; \(a\), \(b\): the success probabilities; \(p\), \(q\): the densities of \(P\) and \(Q\).
where \(\mathrm{KL}(P \,\|\, Q) = \E_P[\log p(X)/q(X)]\), with \(p\), \(q\) the densities of \(P\), \(Q\).
where \(p\), \(q_\theta\): the densities of \(P\) and \(Q_\theta\); \(z\), \(x\): the latent and the observed data.
\[\mathcal{L}(q, \theta) = \E_q[\log p(X, Z \mid \theta)] - \E_q[\log q(Z)] = \underbrace{\E_q[\log p(X, Z \mid \theta)]}_{\text{fit}} + \underbrace{H(q)}_{\text{entropy of } q}\]
where \(H(q) = -\E_q[\log q(Z)]\): the entropy of \(q\), in nats (for a continuous \(Z\), the differential entropy \(-\int q(z)\log q(z)\,dz\), which can be negative).
| Symbol | Meaning |
|---|---|
| \(X\), \(Z\) | observed data, latent data |
| \(p(X, Z \mid \theta)\) | joint density of observed and latent data |
| \(p(Z \mid X, \theta)\) | posterior of the latent data |
| \(L(\theta; X)\), \(\ell(\theta; X)\) | likelihood, log-likelihood |
| \(L_c\), \(\ell_c\) | complete-data likelihood, log-likelihood |
| \(q(Z)\), \(\E_q\) | a distribution for \(Z\), expectation under it |
| \(\mathcal{L}(q, \theta)\) | evidence lower bound (ELBO) |
| Symbol | Meaning |
|---|---|
| \(I(p) = -\log_2 p\) | information of an event of probability \(p\) |
| \(H(X)\), \(H(P)\) | entropy |
| \(H(P, Q)\) | cross-entropy |
| \(\mathrm{KL}(P \,\Vert\, Q)\) | Kullback–Leibler divergence |
| \(Q_\theta\), \(q_\theta\) | model distribution, its density |
| bit, nat | units of \(\log_2\) and \(\log\); 1 nat \(= 1/\log 2\) bits |
The log of an integral is what makes these likelihoods hard. Jensen’s inequality trades it for an average of logs, at the price of a gap, and information theory says exactly what the gap is.
Next: the identity \(\ell(\theta; X) = \mathcal{L}(q, \theta) + \mathrm{KL}\bigl(q(Z) \,\|\, p(Z \mid X, \theta)\bigr)\) and the EM algorithm built on it: the E-step sets \(q\) to the posterior, the M-step maximizes the bound over \(\theta\).
where the differential entropy of a density \(p\) is \(-\int p(x)\log_2 p(x)\,dx\); \(\sigma^2\): the variance.
where \(E(x)\): the energy of state \(x\); \(\mathcal{Z}\), \(\mathcal{Z}_T\): the normalizing constants; \(T > 0\): the temperature, in units where Boltzmann’s constant is 1; \(L(\theta; X)\): the likelihood; \(\pi(\theta)\): the prior.
where \(p_T(x) \propto e^{-E(x)/T}\); the entropies are differential entropies.