Least-Squares Regression
引入本课内容
| English | 释义 | 拼音 |
|---|---|---|
| least-squares line/liːst skweəz laɪn/ | 最小二乘线 | zuì xiǎo èr chéng xiàn |
| sum of squared residuals | 残差平方和 | cán chà píng fāng hé |
| slope/sləʊp/ | 斜率 | xié lǜ |
| intercept/ˌɪntəˈsept/ | 截距 | jié jù |
| Residuals/rɪˈsɪdʒuːəlz/ | 残差 | cán chà |
| r-squared | 决定系数 | jué dìng xì shù |
| variation/ˌveərɪˈeɪʃn/ | 变异 | biàn yì |
| coefficient of determination/ˌkəʊɪˈfɪʃənt ɒv dɪˌtɜːmɪˈneɪʃn/ | 决定系数 | jué dìng xì shù |
| correlation/ˌkɒrɪˈleɪʃn/ | 相关系数 | xiāng guān xì shù |
| linear relationship/ˈlɪnɪə rɪˈleɪʃənʃɪp/ | 线性关系 | xiàn xìng guān xì |
| prediction error | 预测误差 | yù cè wù chā |
| standard deviation of the residuals | 残差标准差 | cán chà biāo zhǔn chā |
| response/rɪˈspɒns/ | 响应变量 | xiǎng yìng biàn liàng |
| summary stats | 汇总统计量 | huì zǒng tǒng jì liàng |
| summary statistics/ˈsʌməri stəˈtɪstɪks/ | 汇总统计量 | huì zǒng tǒng jì liàng |
| raw data | 原始数据 | yuán shǐ shù jù |
| standard deviations/ˈstændəd ˌdiːvɪˈeɪʃnz/ | 标准差 | biāo zhǔn chà |
| linear model/ˈlɪnɪə ˈmɒdl/ | 线性模型 | xiàn xìng mó xíng |
为什么叫“最小二乘”?
- 有许多条线都能穿过一团点——哪一条最好?
- 最小二乘线是使残差平方和尽可能小的那一条。
- 平方使误差变为非负数,并使较大的偏差受到更重的惩罚。
- 使这个总和最小,就能确定唯一的最佳拟合斜率和截距。

残差等于观测值减去预测值;最小二乘法使残差平方和尽可能小
r 平方:被解释的变异
- 决定系数 $r^2$ 是模型解释了 $y$ 变异的比例。
- 它就是相关系数的平方,所以 $0 \le r^2 \le 1$。
- $r^2 = 0.64$ 表示“$y$ 变异的 $64\%$ 由其与 $x$ 的线性关系解释。”
- 其余的($36\%$)归因于其他因素和散布。

s:典型的预测误差
- 残差的标准差 $s$ 是预测误差的典型大小。
- 它的单位与 $y$ 相同:“预测通常偏离大约 $s$。”
- 对于相同的响应变量、相同的单位和可比较的数据,$s$ 越小,拟合越紧密。不同响应变量尺度上的值不能直接比较。
- $s$ 回答“用实际单位衡量,偏离了多远?”,而 $r^2$ 回答“解释了多大比例?”
由汇总统计量求斜率
- 不用原始数据,你就能从汇总统计量构建这条直线:
- 斜率:$b = r\dfrac{s_y}{s_x}$——相关系数按散布之比缩放。
- 截距:直线总是穿过 $(\bar{x}, \bar{y})$,所以 $a = \bar{y} - b\bar{x}$。
- 这两个公式可根据 $r$、均值和标准差求出 $\hat{y} = a + bx$。
不要把两个拟合指标弄混。$r^2$ 是一个无单位的比例(“解释了 $64\%$ 的变异”);$s$ 是一个以 $y$ 为单位的典型误差(“偏离大约 $s$”)。计算斜率时要注意顺序:$b = r\,s_y/s_x$——是 $s_y$(响应变量的散布)除以 $s_x$(解释变量的散布),不能反过来。
某个拟合模型有 $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\%$。
最小二乘线使残差平方和最小。$r^2$ 是被解释的 $y$ 变异比例(无单位,$0$–$1$);$s$ 是典型预测误差(单位与 $y$ 相同)。根据汇总统计量,$b = r\dfrac{s_y}{s_x}$,且直线穿过 $(\bar{x}, \bar{y})$。
根据给出的数据作答
- 对于一个线性模型,相关系数 r 为 0.9。
- 课中决定系数为 0.64 的是另一个模型。
A least-squares linear model with an intercept has correlation r=0.9. What percentage of the variation in y does the model explain?
r squared is the fraction of variation explained.
For a least-squares linear model with an intercept and r=0.9, what percentage of variation in y is explained?
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
r²=0.9²=0.81. Convert the fraction to a percentage: 0.81×100=81% of the variation in y is explained by its linear relationship with x.
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).
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
b = 0.8 × (10/2) = 0.8 × 5 = 4.
If the correlation is r = 0.8, what is r-squared?
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
r² = 0.8² = 0.64.
r² = 0.64 is best interpreted as...
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
r² is the fraction of y's variation explained.
The least-squares line minimizes the sum of the squared residuals.
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
That is exactly the criterion that defines it.
Which quantity is a typical prediction error, measured in the units of y?
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
s is in y-units; r² and r are unitless.
出了什么问题?只有网站团队能看到这些信息。