故事 · 从一条线到「这条线可信吗」 Origin Story · From a Line to "Can We Trust This Line?"
GaussLegendre 给了我们最小二乘那条唯一的线,但它只是点估计 —— 换一批样本,斜率就会抖一下。 真正的问题是:这个抖动有多大?斜率会不会其实是 0(x 根本没影响 y)? 答案来自 Gosset(笔名 Student)1908 年为吉尼斯酒厂小样本发明的 t 分布:把估计的斜率 β̂₁ 除以它自己的标准误 SE(β̂₁), 得到一个 t 统计量,再和 t 分布的临界值比 —— 越过临界,才敢说「斜率显著不为 0」。 同一套标准误还派生出两条喇叭形误差带:置信带问「平均响应会落在哪」,预测带问「下一个单值会落在哪」。 后者恒比前者宽,因为它多背了一份单值本身的随机噪声。 Gauss and Legendre handed us the one least-squares line, but it is only a point estimate — draw a fresh sample and the slope wobbles. The real question is: how large is that wobble, and could the slope actually be zero (x doesn't affect y at all)? The answer comes from the t distribution that Gosset (pen name "Student") invented in 1908 for Guinness's small samples: divide the estimated slope β̂₁ by its own standard error SE(β̂₁), get a t statistic, and compare it with the t distribution's critical value — only when it crosses do we dare say "the slope is significantly nonzero." The same standard error spawns two funnel-shaped error bands: the confidence band asks "where does the mean response land," the prediction band asks "where does the next single value land." The latter is always wider, because it carries one extra dose of an individual observation's own noise.

1 两条喇叭 · 置信带(窄)套在预测带(宽)里 Two Funnels · Confidence Band (Narrow) Nested Inside Prediction Band (Wide)

±—

蓝色内带 = 置信带(平均响应的区间),橙色外带 = 预测带(单个新观测的区间)。两带都在 处最窄、越往两端越张开(杠杆项 (x₀−x̄)²/Sxx)。 Blue inner band = confidence band (interval for the mean response), orange outer band = prediction band (interval for one new observation). Both pinch narrowest at and flare toward the edges (the leverage term (x₀−x̄)²/Sxx).

2 斜率显著吗 · t 落在拒绝域了吗 Is the Slope Significant · Does t Fall in the Rejection Region

3 动手算一遍 · 从 6 个点到 t、CI、PI Work It Out · From 6 Points to t, CI, and PI

数据(广告投入 x → 销量 y,n = 6): Data (ad spend x → sales y, n = 6): x = 2, 4, 6, 8, 10, 12  ·  y = 9, 18, 21, 27, 36, 39

x̄ = 7,   ȳ = 25   →   Sxx = Σ(x−x̄)² = 25+9+1+1+9+25 = 70
Sxy = Σ(x−x̄)(y−ȳ) = 210   →   β̂₁ = Sxy/Sxx = 210/70 = 3,   β̂₀ = ȳ − β̂₁x̄ = 25 − 21 = 4
SSE = Σ(y−ŷ)² = 1+4+1+1+4+1 = 12  ·  df = n−2 = 4
s = √[SSE/(n−2)] = √(12/4) = √3 = 1.732  (回归标准误regression std error)
SE(β̂₁) = s/√Sxx = 1.732/√70 = 0.207
t = β̂₁/SE(β̂₁) = 3/0.207 = 14.49   vs   t0.025, 4 = 2.776   →   14.49 ≫ 2.776,斜率高度显著 (p ≈ 0.0001)

在 x₀ = 10 处(ŷ₀ = 4 + 3·10 = 34),置信区间 vs 预测区间: At x₀ = 10 (ŷ₀ = 4 + 3·10 = 34), confidence vs prediction interval:

杠杆项leverage (x₀−x̄)²/Sxx = 9/70 = 0.129,   1/n = 0.167
CI(平均) = 34 ± 2.776·1.732·√(0.167+0.129) = 34 ± 2.61[31.4, 36.6]
PI(单值) = 34 ± 2.776·1.732·√(1+0.167+0.129) = 34 ± 5.47[28.5, 39.5]
预测带宽度是置信带的the prediction band is 5.47/2.61 ≈ 2.1× 倍 —— 那份「+1」的单值噪声wider — that extra "+1" of individual noise

4 现实里的回归推断 Regression Inference in the Real World

斜率显著性:温度每升 1℃ 真的多耗 3.2 kWh 电吗?t 检验给出「这不是抽样噪声造出来的斜率」的统计证据。 Slope significance: does each +1℃ really add 3.2 kWh of load? The t-test provides statistical evidence that "this slope is not an artifact of sampling noise."
置信带做验收:标定曲线的平均关系落在哪个窄带里 —— 用置信带判断校准线是否稳。 Confidence band for validation: which narrow band the average calibration relationship lives in — use the CI band to judge whether the calibration line is stable.
预测带做承诺:给客户报「单件产品会落在什么范围」时必须用预测带,用置信带会把风险严重低估。 Prediction band for promises: quoting "where a single unit will fall" to a customer requires the prediction band; using the CI band badly understates the risk.
标准误看信息量:SE(β̂₁) = s/√Sxx —— 想把斜率估得更准,要么降噪声 s,要么把 x 铺得更开(增大 Sxx)。 Std error shows information: SE(β̂₁) = s/√Sxx — to estimate the slope more sharply, either cut the noise s or spread x wider (raise Sxx).
一句话In One Line
推断就是给点估计配上误差棒。回归标准误 s 度量点绕线散多开;把它一压缩, 斜率的抖动 SE(β̂₁)=s/√Sxx 就出来了;斜率除以自己的抖动得到 t,越过临界就说明「斜率不是 0」。 同一个 s 撑起两条喇叭:置信带只含「均值估计的不确定」(1/n + 杠杆), 预测带还要额外背一份「单值本身的随机」(那个 +1),所以预测带永远更宽。 记住:想收窄置信带,加样本 n;但预测带有个下限 —— 单值噪声 s 你消不掉,只能靠更好的模型或更小的 σ。 Inference is a point estimate wearing error bars. The regression standard error s measures how far points scatter around the line; squeeze it and the slope's wobble SE(β̂₁)=s/√Sxx follows; divide the slope by its own wobble to get t, and crossing the critical value means "the slope is not zero." The same s raises two funnels: the confidence band carries only "uncertainty in the mean estimate" (1/n + leverage), while the prediction band also shoulders "an individual value's own randomness" (that +1), so it is always wider. Remember: to narrow the CI band, add sample size n; but the PI band has a floor — the single-value noise s cannot be eliminated, only shrunk with a better model or smaller σ.
常见误用Common Mistakes
用置信带当预测带给单件产品报范围要用更宽的预测带;置信带只描述平均,会把风险低估一半以上。 Using the CI band where a PI band is needed. Quoting a single unit's range needs the wider prediction band — the CI band only describes the mean and can understate risk by more than half.
斜率不显著就当「x 与 y 无关」不显著可能只是样本太小或 x 铺得太窄(Sxx 小);先看 SE 和功效,别急着下结论。 Reading a non-significant slope as "x and y are unrelated". Non-significance can just mean n is small or x is spread too narrow (small Sxx) — check SE and power before concluding.
把区间外推到数据范围之外杠杆项 (x₀−x̄)² 在远端爆炸,区间会宽到无意义,且线性假设本身可能已失效。 Extrapolating intervals beyond the data range. The leverage term (x₀−x̄)² explodes far out, intervals blow up to meaninglessness, and linearity itself may have broken down.

回归推断