Least-Squares Regression · 最小二乘回归
| English | 中文 | Pinyin · 拼音 |
|---|---|---|
| least-squares line/liːst skweəz laɪn/ | 最小二乘线 | zuì xiǎo èr chéng xiàn |
| coefficient of determination/ˌkəʊɪˈfɪʃənt ɒv dɪˌtɜːmɪˈneɪʃn/ | 决定系数 | jué dìng xì shù |
Why "least squares"?
- Many lines could pass through a cloud — which is best?
- The least-squares line 最小二乘线 is the one that makes the sum of squared residuals as small as possible.
- Squaring keeps errors positive and punishes big misses extra hard.
- Minimizing that total is what pins down the unique best-fit slope and intercept.
为什么叫“最小二乘”?
- 有许多条线都能穿过一团点——哪一条最好?
- 最小二乘线是使残差平方和尽可能小的那一条。
- 平方让误差保持为正,并对大的偏差额外重罚。
- 让那个总和最小,正是它钉住唯一最佳拟合斜率和截距的方式。
r-squared: variation explained
- The coefficient of determination 决定系数 $r^2$ is the fraction of the variation in $y$ explained by the model.
- It's literally the square of the correlation, so $0 \le r^2 \le 1$.
- $r^2 = 0.64$ means "$64\%$ of the variation in $y$ is explained by the linear relationship with $x$."
- The rest ($36\%$) is due to other factors and scatter.
r 平方:被解释的变异
- 决定系数 $r^2$ 是模型解释了 $y$ 变异的比例。
- 它就是相关系数的平方,所以 $0 \le r^2 \le 1$。
- $r^2 = 0.64$ 表示“$y$ 的变异有 $64\%$ 被与 $x$ 的线性关系解释了”。
- 其余的($36\%$)归因于其他因素和散布。
s: typical prediction error
- The standard deviation of the residuals $s$ is the typical size of a prediction error.
- It's in the units of $y$: "predictions are typically off by about $s$."
- Smaller $s$ = tighter fit; larger $s$ = looser predictions.
- $s$ answers "how far off, in real units?" while $r^2$ answers "what fraction explained?"
s:典型的预测误差
- 残差的标准差 $s$ 是预测误差的典型大小。
- 它的单位与 $y$ 相同:“预测通常偏离大约 $s$。”
- $s$ 越小 = 拟合越紧;$s$ 越大 = 预测越松。
- $s$ 回答“以真实单位偏离多远?”,而 $r^2$ 回答“解释了多大比例?”。
Slope from summary stats
- You can build the line from summary statistics without the raw data:
- Slope: $b = r\dfrac{s_y}{s_x}$ — correlation scaled by the ratio of spreads.
- Intercept: the line always passes through $(\bar{x}, \bar{y})$, so $a = \bar{y} - b\bar{x}$.
- These two formulas recover $\hat{y} = a + bx$ from $r$, the means, and the standard deviations.
由汇总统计量求斜率
- 不用原始数据,你就能从汇总统计量构建这条线:
- 斜率:$b = r\dfrac{s_y}{s_x}$——相关系数按散布之比缩放。
- 截距:直线总是穿过 $(\bar{x}, \bar{y})$,所以 $a = \bar{y} - b\bar{x}$。
- 这两个公式能从 $r$、均值和标准差还原出 $\hat{y} = a + bx$。
Don't confuse the two fit numbers. $r^2$ is a unitless fraction ("$64\%$ of variation explained"); $s$ is a typical error in the units of $y$ ("off by about $s$"). And when you compute the slope, mind the order: $b = r\,s_y/s_x$ — it's $s_y$ (response spread) over $s_x$ (explanatory spread), not the reverse.
不要把两个拟合数字弄混。$r^2$ 是一个无单位的比例(“解释了 $64\%$ 的变异”);$s$ 是一个以 $y$ 为单位的典型误差(“偏离大约 $s$”)。而计算斜率时要注意顺序:$b = r\,s_y/s_x$——是 $s_y$(响应散布)除以 $s_x$(解释散布),不能反过来。
A fit has $r = 0.8$, $s_x = 2$, $s_y = 10$, $\bar{x}=5$, $\bar{y}=60$.
- Slope: $b = 0.8 \times \dfrac{10}{2} = 4$.
- Intercept: $a = 60 - 4(5) = 40$, so $\hat{y} = 40 + 4x$.
- $r^2 = 0.64$: $64\%$ of the variation in $y$ is explained by the model.
某拟合有 $r = 0.8$、$s_x = 2$、$s_y = 10$、$\bar{x}=5$、$\bar{y}=60$。
- 斜率:$b = 0.8 \times \dfrac{10}{2} = 4$。
- 截距:$a = 60 - 4(5) = 40$,所以 $\hat{y} = 40 + 4x$。
- $r^2 = 0.64$:$y$ 的变异有 $64\%$ 被模型解释了。
The least-squares line minimizes the sum of squared residuals. $r^2$ is the fraction of variation in $y$ explained (unitless, $0$–$1$); $s$ is the typical prediction error (units of $y$). From summary stats, $b = r\dfrac{s_y}{s_x}$ and the line passes through $(\bar{x}, \bar{y})$.
最小二乘线使残差平方和最小。$r^2$ 是被解释的 $y$ 变异比例(无单位,$0$–$1$);$s$ 是典型预测误差($y$ 的单位)。由汇总统计量,$b = r\dfrac{s_y}{s_x}$,且直线穿过 $(\bar{x}, \bar{y})$。
The best-fit least-squares line · 最佳拟合的最小二乘直线
The line that makes the total squared vertical gap smallest. · 使竖直间隙平方总和最小的那条线。
With r = 0.8, s_x = 2, s_y = 10, find the slope b = r·(s_y/s_x). · 已知 r = 0.8、s_x = 2、s_y = 10,求斜率 b = r·(s_y/s_x)。
b = 0.8 × (10/2) = 0.8 × 5 = 4. · b = 0.8 × (10/2) = 0.8 × 5 = 4。
If the correlation is r = 0.8, what is r-squared? · 若相关系数 r = 0.8,则 r 平方是多少?
r² = 0.8² = 0.64. · r² = 0.8² = 0.64。
r² = 0.64 is best interpreted as... · r² = 0.64 最好的解释是……
r² is the fraction of y's variation explained. · r² 是被解释的 y 变异比例。
The least-squares line minimizes the sum of the squared residuals. · 最小二乘线使残差平方和最小。
That is exactly the criterion that defines it. · 这正是定义它的准则。
Which quantity is a typical prediction error, measured in the units of y? · 哪个量是典型预测误差,以 y 的单位度量?
s is in y-units; r² and r are unitless. · s 以 y 为单位;r² 和 r 无单位。