The Parameter Posterior
Page 905 made predictions from the prior alone. Now the data arrives.
Theorem 9.1 turns Bayes’ theorem into two lines of linear algebra. The verification here is the definition itself — a posterior is proportional to likelihood times prior, so the log gap must not depend on . Measured, it varies by .
And one property the book does not mention falls straight out: you can run the update one observation at a time, forever, with fixed memory.
What you’ll learn
Section titled “What you’ll learn”- Equations 9.41–9.42: Bayes on the parameters, and the marginal likelihood that normalises it.
- Theorem 9.1 — and — verified two ways.
- That precisions add: each observation contributes a rank-one term , measured to .
- Sequential updating: one batch of ten, four-then-six, and one-at-a-time all agree to .
- is page 904’s MAP estimate — measured to — and approaches the MLE as the prior flattens.
- The posterior contracts like , and the constant it settles at.
- The posterior is not isotropic even though the prior is. Largest off-diagonal correlation after ten points: .
Intuition: information adds, uncertainty does not
Section titled “Intuition: information adds, uncertainty does not”The natural quantity here is not the covariance but its inverse — the precision. Equation 9.43b says
Precisions add. Each data point drops in an independent contribution, and the order you add them in cannot matter — which is why the whole update runs online.
It also explains where the posterior shrinks. The term is rank one: it adds information only along the direction . Observe at and you learn about the constant term and almost nothing about . The ellipse shrinks in the directions the data probes and stays put in the others — and page 904’s prior is what keeps it finite in the directions never probed at all.
The mean is a precision-weighted average: prior mean weighted by , data estimate weighted by . Whichever knows more, wins.
flowchart TD A["prior precision S0^-1"] B["one term per observation
phi_n phi_n' / sigma^2, rank ONE"] A --> C["posterior precision S_N^-1
Eq 9.43b"] B --> C C -->|"invert"| D["S_N"] D --> E["m_N = S_N (S0^-1 m0 + Phi'y/sigma^2)
Eq 9.43c, a precision-weighted average"] C -.->|"a SUM, so order cannot matter"| F["sequential updating
measured 4.1e-12"] E -.->|"m0 = 0, S0 = b^2 I"| G["Eq 9.31's MAP estimate
measured 1.2e-13"] E -.->|"S0 to infinity"| H["Eq 9.19's MLE"] C --> I["off-diagonals come from Phi'Phi
correlations up to 0.9696"]
§9.3.3 The posterior distribution
Section titled “§9.3.3 The posterior distribution”Bayes’ theorem on the parameters (Equation 9.41):
with the denominator (Equation 9.42)
the marginal likelihood or evidence, “which is independent of the parameters and ensures that the posterior is normalized”. The book’s margin note gives the reading: “the marginal likelihood is the expected likelihood under the parameter prior” — page 808’s Equation 8.44, arriving here.
Page 901 measured why this term is the whole difficulty: the likelihood integrates to over , so something must supply the missing normaliser. §9.3.5 computes it.
Theorem 9.1
Section titled “Theorem 9.1”“where the subscript indicates the size of the training set.” The book proves it by transforming “into log-space and solv[ing] for the mean and covariance of the posterior by completing the squares.”
Precisions add
Section titled “Precisions add”What the posterior mean turns out to be
Section titled “What the posterior mean turns out to be”How fast it contracts
Section titled “How fast it contracts”The posterior is not isotropic
Section titled “The posterior is not isotropic”The prior correlation matrix is the identity: asserts no relationship between coefficients. After ten observations:
Worked example by hand
Section titled “Worked example by hand”Derive Theorem 9.1 for by completing the square — the book’s proof, in a case small enough to watch.
Model: , , prior .
Step 1: add the two logs. Dropping -free terms (Equation 9.45b):
Step 2: expand and collect powers of .
Step 3: read off the precision. The coefficient of is the posterior precision:
which is Equation 9.43b — precisions add, and the data’s contribution is .
Step 4: complete the square. , so the posterior is with
which is Equation 9.43c.
Step 5: read the mean as a weighted average. Substituting :
using from page 901. The weights are the two precisions, and they sum to one.
Step 6: check the limits. gives and ; gives . And recovers page 904’s shrinkage factor exactly. Five pages, one formula.
See it move
Section titled “See it move”From scratch
Section titled “From scratch”import numpy as np
SIG = 0.2
M, K = 5, 6
def truth(x):
return -np.sin(x / 5) + np.cos(x)
def design(x, m=M):
return np.vander(np.asarray(x, float), m + 1, increasing=True)
def posterior(P, yv, m0, S0, sig=SIG):
"""Theorem 9.1, Equations 9.43b and 9.43c."""
SN = np.linalg.inv(np.linalg.inv(S0) + P.T @ P / sig ** 2)
mN = SN @ (np.linalg.solve(S0, m0) + P.T @ yv / sig ** 2)
return mN, SN
def logN(v, m, S):
d = v - m
_, ld = np.linalg.slogdet(S)
return float(-0.5 * (d @ np.linalg.solve(S, d) + ld
+ len(v) * np.log(2 * np.pi)))
m0 = np.zeros(K)
S0 = 0.25 * np.eye(K)
rng = np.random.default_rng(4)
x = np.sort(rng.uniform(-5, 5, 10))
y = truth(x) + SIG * rng.standard_normal(10)
Phi = design(x)
mN, SN = posterior(Phi, y, m0, S0)
th_ml = np.linalg.lstsq(Phi, y, rcond=None)[0]
prec_data = Phi.T @ Phi / SIG ** 2
# --- 1. Theorem 9.1, checked exactly ------------------------------------
print("=== 1. Theorem 9.1, checked exactly ===")
print("Bayes says log p(theta | D) - [log lik + log prior] is a CONSTANT.")
r = np.random.default_rng(9)
offs = []
print(f"{'trial':>6} {'log posterior':>16} {'log lik + log prior':>21} "
f"{'difference':>14}")
for t in range(6):
th = mN + np.linalg.cholesky(SN) @ r.standard_normal(K) * 2.0
lp = logN(th, mN, SN)
lj = (logN(y, Phi @ th, SIG ** 2 * np.eye(len(y)))
+ logN(th, m0, S0))
offs.append(lp - lj)
print(f"{t:>6} {lp:>16.6f} {lj:>21.6f} {offs[-1]:>14.6f}")
print(f"\nspread of that difference over 6 random theta: "
f"{max(offs) - min(offs):.3e}")
print(f"the constant itself is -log p(Y | X) = {offs[0]:.6f},")
print("which is Equation 9.42's marginal likelihood -- Section 9.3.5's job.")
print("\n--- and a grid cross-check in 2 dimensions (degree 1) ---")
P2 = design(x, 1)
m2, S2 = posterior(P2, y, np.zeros(2), 0.25 * np.eye(2))
g = 1400
a = np.linspace(m2[0] - 6*np.sqrt(S2[0, 0]), m2[0] + 6*np.sqrt(S2[0, 0]), g)
b = np.linspace(m2[1] - 6*np.sqrt(S2[1, 1]), m2[1] + 6*np.sqrt(S2[1, 1]), g)
A, B = np.meshgrid(a, b, indexing="ij")
TH = np.stack([A.ravel(), B.ravel()], 1)
R = y[None, :] - TH @ P2.T
lg = -0.5*(R**2).sum(1)/SIG**2 - 0.5*(TH**2).sum(1)/0.25
w = np.exp(lg - lg.max()); w /= w.sum()
gm = w @ TH
gc = (TH - gm).T @ ((TH - gm) * w[:, None])
cc = S2[0, 1]/np.sqrt(S2[0, 0]*S2[1, 1])
gcc = gc[0, 1]/np.sqrt(gc[0, 0]*gc[1, 1])
print(f"{'':>14} {'Theorem 9.1':>16} {'grid':>16} {'difference':>13}")
print(f"{'mean[0]':>14} {m2[0]:>16.8f} {gm[0]:>16.8f} {abs(m2[0]-gm[0]):>13.2e}")
print(f"{'mean[1]':>14} {m2[1]:>16.8f} {gm[1]:>16.8f} {abs(m2[1]-gm[1]):>13.2e}")
print(f"{'sd[0]':>14} {np.sqrt(S2[0,0]):>16.8f} {np.sqrt(gc[0,0]):>16.8f} "
f"{abs(np.sqrt(S2[0,0])-np.sqrt(gc[0,0])):>13.2e}")
print(f"{'sd[1]':>14} {np.sqrt(S2[1,1]):>16.8f} {np.sqrt(gc[1,1]):>16.8f} "
f"{abs(np.sqrt(S2[1,1])-np.sqrt(gc[1,1])):>13.2e}")
print(f"{'corr':>14} {cc:>16.8f} {gcc:>16.8f} {abs(cc-gcc):>13.2e}")
print("a 1400 x 1400 numerical posterior, matching the closed form to 1e-8.")
# --- 2. precisions add ---------------------------------------------------
print("\n=== 2. Equation 9.43b says PRECISIONS add ===")
prec_prior = np.linalg.inv(S0)
resid = SN @ (prec_prior + prec_data) - np.eye(K)
print(f"max |S_N (S_0^-1 + sigma^-2 Phi^T Phi) - I| = {np.abs(resid).max():.3e}")
acc = prec_prior.copy()
for n in range(len(y)):
acc = acc + np.outer(Phi[n], Phi[n]) / SIG ** 2
print(f"accumulating one point at a time: max |S_N acc - I| = "
f"{np.abs(SN @ acc - np.eye(K)).max():.3e}")
print("information adds; variance does not.")
# --- 3. m_N is the MAP estimate -----------------------------------------
print("\n=== 3. m_N reduces to the MAP estimate of Equation 9.31 ===")
print(f"{'b^2':>8} {'max |m_N - theta_MAP|':>24}")
for b2 in (0.01, 0.25, 1.0, 100.0):
mm, _ = posterior(Phi, y, np.zeros(K), b2 * np.eye(K))
mp = np.linalg.solve(Phi.T @ Phi + (SIG**2 / b2) * np.eye(K), Phi.T @ y)
print(f"{b2:>8.2f} {np.abs(mm - mp).max():>24.3e}")
print("identical. The MAP estimate is the posterior MEAN.")
print("\nand as the prior flattens, m_N approaches the MLE:")
print(f"{'b^2':>10} {'max |m_N - theta_ML|':>23}")
for b2 in (1.0, 1e2, 1e4, 1e6, 1e8):
mm, _ = posterior(Phi, y, np.zeros(K), b2 * np.eye(K))
print(f"{b2:>10.0e} {np.abs(mm - th_ml).max():>23.3e}")
# --- 4. a precision-weighted average ------------------------------------
print("\n=== 4. the posterior mean is a precision-weighted average ===")
m0b = np.full(K, 0.5)
S0b = 0.25 * np.eye(K)
mb, _ = posterior(Phi, y, m0b, S0b)
print(f"{'k':>3} {'prior mean':>12} {'MLE':>12} {'m_N':>12} "
f"{'weight on prior':>17}")
for k in range(K):
wpri = float(np.linalg.inv(S0b)[k, k]
/ (np.linalg.inv(S0b)[k, k] + prec_data[k, k]))
print(f"{k:>3} {m0b[k]:>12.6f} {th_ml[k]:>12.6f} {mb[k]:>12.6f} "
f"{wpri:>17.6f}")
print("the coefficients the data constrains most are pulled least.")
# --- 5. sequential updating ---------------------------------------------
print("\n=== 5. conjugacy means you can update SEQUENTIALLY ===")
mA, SA = posterior(Phi[:4], y[:4], m0, S0)
mB, SB = posterior(Phi[4:], y[4:], mA, SA)
print(f"one batch of 10 : m_N = {np.round(mN, 6).tolist()}")
print(f"4 then 6 : m_N = {np.round(mB, 6).tolist()}")
print(f"max |difference|: {np.abs(mB - mN).max():.3e}")
print(f"covariance, max |difference|: {np.abs(SB - SN).max():.3e}")
mS, SS = m0.copy(), S0.copy()
for n in range(len(y)):
mS, SS = posterior(Phi[n:n+1], y[n:n+1], mS, SS)
print(f"one point at a time, max |difference| in m_N: "
f"{np.abs(mS - mN).max():.3e}")
print("today's posterior is tomorrow's prior, exactly.")
# --- 6. contraction rate -------------------------------------------------
print("\n=== 6. how fast does the posterior contract? ===")
print(f"{'N':>7} {'max posterior sd':>18} {'|S_N|^(1/K)':>14} "
f"{'sd x sqrt(N)':>14}")
for n in (1, 2, 5, 10, 50, 200, 1000, 5000):
r3 = np.random.default_rng(100 + n)
xs = np.sort(r3.uniform(-5, 5, n))
ys = truth(xs) + SIG * r3.standard_normal(n)
_, Sn = posterior(design(xs), ys, m0, S0)
sd = np.sqrt(np.diag(Sn)).max()
_, ld = np.linalg.slogdet(Sn)
print(f"{n:>7} {sd:>18.6e} {np.exp(ld/K):>14.3e} {sd*np.sqrt(n):>14.6f}")
print("sd times sqrt(N) is roughly constant past N = 50.")
# --- 7. the posterior is not isotropic ----------------------------------
print("\n=== 7. the posterior is NOT isotropic, though the prior is ===")
D = np.sqrt(np.diag(SN))
C = SN / np.outer(D, D)
print(f"{'':>4}" + "".join(f"{k:>9}" for k in range(K)))
for i in range(K):
print(f"{i:>4}" + "".join(f"{C[i, j]:>9.4f}" for j in range(K)))
off = C[~np.eye(K, dtype=bool)]
print(f"\nlargest off-diagonal correlation in magnitude: {np.abs(off).max():.6f}")
print("the data induces strong correlations between coefficients, which is")
print("exactly the information a point estimate throws away.")=== 1. Theorem 9.1, checked exactly ===
Bayes says log p(theta | D) - [log lik + log prior] is a CONSTANT.
trial log posterior log lik + log prior difference
0 14.198067 -16.255340 30.453407
1 10.441495 -20.011912 30.453407
2 5.986926 -24.466481 30.453407
3 3.530499 -26.922909 30.453407
4 17.837312 -12.616095 30.453407
5 9.849645 -20.603762 30.453407
spread of that difference over 6 random theta: 1.805e-12
the constant itself is -log p(Y | X) = 30.453407,
which is Equation 9.42's marginal likelihood -- Section 9.3.5's job.
--- and a grid cross-check in 2 dimensions (degree 1) ---
Theorem 9.1 grid difference
mean[0] -0.02383666 -0.02383666 2.36e-16
mean[1] -0.21330150 -0.21330150 1.14e-15
sd[0] 0.06542924 0.06542923 2.51e-09
sd[1] 0.02123647 0.02123647 8.16e-10
corr -0.28346073 -0.28346071 1.85e-08
a 1400 x 1400 numerical posterior, matching the closed form to 1e-8.
=== 2. Equation 9.43b says PRECISIONS add ===
max |S_N (S_0^-1 + sigma^-2 Phi^T Phi) - I| = 6.926e-11
accumulating one point at a time: max |S_N acc - I| = 6.835e-11
information adds; variance does not.
=== 3. m_N reduces to the MAP estimate of Equation 9.31 ===
b^2 max |m_N - theta_MAP|
0.01 4.180e-14
0.25 3.453e-14
1.00 1.186e-13
100.00 2.986e-14
identical. The MAP estimate is the posterior MEAN.
and as the prior flattens, m_N approaches the MLE:
b^2 max |m_N - theta_ML|
1e+00 1.409e-02
1e+02 1.432e-04
1e+04 1.433e-06
1e+06 1.433e-08
1e+08 1.434e-10
=== 4. the posterior mean is a precision-weighted average ===
k prior mean MLE m_N weight on prior
0 0.500000 0.932129 0.892941 0.015748
1 0.500000 -0.241478 -0.185660 0.001659
2 0.500000 -0.294282 -0.282147 0.000100
3 0.500000 0.004986 -0.003582 0.000005
4 0.500000 0.011836 0.011231 0.000000
5 0.500000 -0.000208 0.000095 0.000000
the coefficients the data constrains most are pulled least.
=== 5. conjugacy means you can update SEQUENTIALLY ===
one batch of 10 : m_N = [0.878372, -0.210306, -0.2817, -0.00012, 0.011271, -1.8e-05]
4 then 6 : m_N = [0.878372, -0.210306, -0.2817, -0.00012, 0.011271, -1.8e-05]
max |difference|: 3.421e-12
covariance, max |difference|: 1.526e-15
one point at a time, max |difference| in m_N: 4.073e-12
today's posterior is tomorrow's prior, exactly.
=== 6. how fast does the posterior contract? ===
N max posterior sd |S_N|^(1/K) sd x sqrt(N)
1 4.999999e-01 1.525e-02 0.500000
2 4.689960e-01 1.429e-02 0.663260
5 3.924009e-01 2.619e-04 0.877435
10 1.399119e-01 5.012e-05 0.442440
50 5.418635e-02 6.709e-06 0.383155
200 2.644539e-02 1.456e-06 0.373994
1000 1.175256e-02 3.078e-07 0.371649
5000 5.356297e-03 6.002e-08 0.378747
sd times sqrt(N) is roughly constant past N = 50.
=== 7. the posterior is NOT isotropic, though the prior is ===
0 1 2 3 4 5
0 1.0000 -0.2411 -0.6166 0.2734 0.4712 -0.2824
1 -0.2411 1.0000 0.2850 -0.9190 -0.2967 0.8052
2 -0.6166 0.2850 1.0000 -0.4535 -0.9687 0.5502
3 0.2734 -0.9190 -0.4535 1.0000 0.4937 -0.9696
4 0.4712 -0.2967 -0.9687 0.4937 1.0000 -0.6132
5 -0.2824 0.8052 0.5502 -0.9696 -0.6132 1.0000
largest off-diagonal correlation in magnitude: 0.969560
the data induces strong correlations between coefficients, which is
exactly the information a point estimate throws away.On real data
Section titled “On real data”Reading the plot
Section titled “Reading the plot”The first figure verifies Theorem 9.1 without redoing its algebra. The definition of a posterior is that it is proportional to likelihood times prior, so the difference of the two log-densities must be a constant — the same number at every . The blue and amber series move over fourteen units across twenty-four random draws. The green line, their difference, does not move at all — of spread, which is floating point.
That is a stronger check than comparing a few numbers, because it tests the whole function rather than a point. And the constant it lands on is not incidental: , Equation 9.42’s marginal likelihood. Verifying the posterior hands you §9.3.5’s answer as a by-product, which is exactly the relationship Bayes’ theorem asserts.
The right panel is an independent route. In two dimensions you can evaluate prior likelihood on a grid and read off the moments numerically. The closed form matches to in mean, standard deviation and correlation — and the remaining error is the grid’s.
The second figure is Equation 9.43b as a picture. Seven nested ellipses, one per sample size. They only ever shrink, and that is forced: a precision matrix is positive semidefinite, and adding one cannot reduce the total.
But look at how they shrink — not uniformly. Each observation adds , a rank-one matrix, so it adds information along exactly one direction. The ellipse contracts hard where the data probes and barely moves elsewhere. That is the geometric reason page 904’s prior was needed: in directions no observation touches, the data adds nothing at all, and only keeps the answer finite.
The right panel measures two consequences. The width falls like — settles near past , which is page 902’s error variance and page 806’s width-ratio collapse arriving a third time. And the sequential check: because the precision is a sum, the order and grouping of the data cannot matter. Ten at once, four-then-six, and one-at-a-time agree to .
The practical consequence is worth stating plainly. Equation 9.43 never needs to exist. Keep a precision matrix and a -vector, add one rank-one update per observation, and you can process an unbounded stream in fixed memory. The book computes the posterior in one shot; it does not have to be computed that way, and that is what conjugacy is worth beyond closed form.
The third figure shows what a point estimate is discarding. Left, the prior correlation matrix: the identity, because asserts nothing about how coefficients relate. Middle, after ten observations: off-diagonal entries up to in magnitude.
Those correlations are not noise — they come entirely from , and they say something specific. and are correlated at : increase one and you must decrease the other to keep fitting the same ten points. The data has determined a combination far better than either coefficient alone.
The right panel prices that. Forty curves drawn from the full posterior , and forty drawn using only its diagonal — identical marginal spread on every coefficient, correlations thrown away. The second cloud is visibly wider and wrong. The marginals are not the distribution, and keeping only discards more than the marginals do.
Compare
Section titled “Compare”| prior, page 905 | posterior, Theorem 9.1 | |
|---|---|---|
| mean | ||
| precision | ||
| correlations | none, measured | up to |
| needs data | no | yes |
| largest sd here | at |
| setting of the prior | becomes | measured |
|---|---|---|
| , | , Eq 9.31 | |
| , Eq 9.19 | at | |
| — | ||
| sd |
| one batch | sequential | |
|---|---|---|
| memory | , so | , fixed |
| result | — | identical to |
| needs all data present | yes | no |
| why it works | — | the precision is a sum |
-
How was Theorem 9.1 verified here, without redoing the completing-the-square proof?
That is the definition of a posterior, so the check tests the whole function rather than a point. The two log-densities move over fourteen units across the trials while their difference does not move at all — and the constant it settles at is minus the log marginal likelihood of Equation 9.42.
pch.quizShowAnswer
B — By checking that the log posterior minus the log likelihood plus log prior is constant in theta — measured to vary by 1.8e-12 — That is the definition of a posterior, so the check tests the whole function rather than a point. The two log-densities move over fourteen units across the trials while their difference does not move at all — and the constant it settles at is minus the log marginal likelihood of Equation 9.42.
-
Equation 9.43b says the posterior precision is the prior precision plus a data term. What shape is each observation's contribution?
So the ellipse shrinks hard where the data probes and barely moves elsewhere. That is the geometric reason page 904's prior was needed: in directions no observation touches, the data adds nothing, and only the prior precision keeps the answer finite.
pch.quizShowAnswer
B — Rank one — phi-n phi-n-transpose over sigma squared, adding information along a single direction — So the ellipse shrinks hard where the data probes and barely moves elsewhere. That is the geometric reason page 904's prior was needed: in directions no observation touches, the data adds nothing, and only the prior precision keeps the answer finite.
-
Because the precision is a sum, what follows that the book does not state?
Today's posterior is tomorrow's prior. Keep a K-by-K precision matrix and a K-vector, add one rank-one update per observation, and you can process an unbounded stream in fixed memory — the design matrix never has to exist.
pch.quizShowAnswer
B — The update can run sequentially — ten at once, four then six, and one at a time all agree to 4.1e-12 — Today's posterior is tomorrow's prior. Keep a K-by-K precision matrix and a K-vector, add one rank-one update per observation, and you can process an unbounded stream in fixed memory — the design matrix never has to exist.
-
With m-zero = 0 and S-zero = b squared times the identity, what is m_N?
For a Gaussian the mode and the mean coincide, so the MAP estimate IS the posterior mean. Chapter 8's page on probabilistic modeling measured the same identity at 8.88e-16. All three estimators in this chapter are one formula at three settings of the prior.
pch.quizShowAnswer
B — Exactly the MAP estimate of Equation 9.31, measured to 1.19e-13 — For a Gaussian the mode and the mean coincide, so the MAP estimate IS the posterior mean. Chapter 8's page on probabilistic modeling measured the same identity at 8.88e-16. All three estimators in this chapter are one formula at three settings of the prior.
-
The prior correlation matrix is the identity. What is the largest off-diagonal posterior correlation after ten observations?
The features are not orthogonal on this data, so what the data learns about one coefficient it learns about others. Theta-three and theta-five are correlated at minus 0.97: increase one and you must decrease the other to keep fitting the same ten points.
pch.quizShowAnswer
B — 0.9696 in magnitude, coming entirely from Phi-transpose-Phi — The features are not orthogonal on this data, so what the data learns about one coefficient it learns about others. Theta-three and theta-five are correlated at minus 0.97: increase one and you must decrease the other to keep fitting the same ten points.
-
Forty curves were drawn from the full posterior and forty using only its diagonal. What was the difference?
The marginals are not the distribution. Keeping only m_N discards even more than that — the whole correlation structure that the data worked to establish, which is precisely the loss of information Chapter 8's Section 8.4.2 warned about.
pch.quizShowAnswer
B — Identical marginal spread per coefficient, but visibly different and wider functions — The marginals are not the distribution. Keeping only m_N discards even more than that — the whole correlation structure that the data worked to establish, which is precisely the loss of information Chapter 8's Section 8.4.2 warned about.
🧪 Try It Yourself
Section titled “🧪 Try It Yourself”Exercise 1 – Theorem 9.1
Section titled “Exercise 1 – Theorem 9.1”Exercise 2 – Precisions add
Section titled “Exercise 2 – Precisions add”Exercise 3 – Today’s posterior is tomorrow’s prior
Section titled “Exercise 3 – Today’s posterior is tomorrow’s prior”Exercise 4 – All three estimators are one formula
Section titled “Exercise 4 – All three estimators are one formula”Exercise 5 – The correlations the prior did not have
Section titled “Exercise 5 – The correlations the prior did not have”Pitfalls
Section titled “Pitfalls”Recall card
Section titled “Recall card”- Equation 9.41 is Bayes on the parameters, and Equation 9.42’s marginal likelihood is what normalises it — the expected likelihood under the prior. Section 9.3.5 computes it.
- Theorem 9.1: the posterior is Gaussian, with precision S-zero-inverse plus Phi-transpose-Phi over sigma squared, and mean S_N times the sum of the two precision-weighted terms.
- Verified by definition: log posterior minus log likelihood minus log prior is constant in theta, to 1.805e-12 — while the two densities move over fourteen units.
- That constant is minus the log marginal likelihood, 30.453407. Checking the posterior hands you Section 9.3.5’s answer as a by-product.
- Cross-checked on a 1400 by 1400 grid in two dimensions: mean, standard deviation and correlation all match to 1e-8. A closed form is not an approximation.
- Precisions add, one rank-one term sigma-inverse-squared phi phi-transpose per observation — measured to 6.9e-11. Information adds; variance does not.
- Rank one means information along ONE direction. The ellipse shrinks where the data probes and barely moves elsewhere, which is why the prior is what keeps unprobed directions finite.
- So the update runs sequentially. One batch of ten, four-then-six and one-at-a-time agree to 4.1e-12, in fixed O(K squared) memory, with the design matrix never formed.
- m_N IS the MAP estimate of Equation 9.31, measured to 1.19e-13 — for a Gaussian the mode and the mean coincide.
- And m_N tends to the MLE as the prior flattens, gaining a factor of 100 of agreement per factor of 100 in b squared.
- The mean is a precision-weighted average of the prior mean and the data estimate. The coefficients the data constrains most are pulled least toward the prior.
- The posterior contracts like one over root N. Measured, sd times root N settles near 0.37 past N = 50 — the same rate as page 902’s error variance and page 806’s width ratio.
- At N = 1 with K = 6, almost nothing is learned: the largest sd is 0.4999999 against a prior 0.5.
- The posterior is not isotropic even though the prior is. Largest off-diagonal correlation after ten points: 0.969560, coming entirely from Phi-transpose-Phi.
- A point estimate discards all of it. Forty curves from the full covariance and forty from its diagonal have the same marginals and different shapes.
Next: use it to predict. Posterior Predictions
pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading