# 简单线性回归

**简单线性回归**是一种统计方法，用一个解释变量 x 和一个响应变量 y 之间的直线关系来建模，通过选择使观测数据点与直线之间垂直距离平方和最小的系数来拟合。拟合模型有三项主要用途：描述关系、控制过程以及预测未来值<sup>[1](https://faculty.etsu.edu/gardnerr/5710/notes-Linear-Models1/Linear-Models1-1-2.pdf)</sup>。由于该方法对数据的利用非常高效，即使数据集相对较小也能获得良好结果<sup>[2](https://www.itl.nist.gov/div898/handbook/pmd/section1/pmd141.htm)</sup>。

| 关键事实 | 详情 |
|---|---|
| 模型 | \( y = \beta_0 + \beta_1 x + \varepsilon \)，一个预测变量，一个响应变量<sup>[3](https://pmc.ncbi.nlm.nih.gov/articles/PMC7462673/)</sup> |
| 斜率估计量 | \( \hat{\beta}_1 = \dfrac{\sum (x_i - \bar{x})(y_i - \bar{y})}{\sum (x_i - \bar{x})^2} \)；截距 \( \hat{\beta}_0 = \bar{y} - \hat{\beta}_1 \bar{x} \)<sup>[4](https://www.itl.nist.gov/div898/handbook/pmd/section4/pmd431.htm)</sup> |
| 误差方差 | 由 \( \mathrm{MSE} = \mathrm{SSE}/(n-2) \) 估计，自由度为 \( n-2 \)<sup>[5](https://stats.libretexts.org/Bookshelves/Computing_and_Modeling/Supplemental_Modules_(Computing_and_Modeling)/Regression_Analysis/Simple_linear_regression/Simple_Linear_Regression_(with_one_predictor))</sup> |
| 精度缩放 | 对于可比设计，系数标准误与回归标准误成正比，大致按 \( 1/\sqrt{n} \) 缩放；数据量增至四倍约可将其减半<sup>[6](https://people.duke.edu/~rnau/mathreg.htm)</sup> |
| \( R^2 \) | 在简单回归中等于 \( r^2 \)，即相关系数的平方；相关系数 0.5 给出 \( R^2 = 0.25 \)<sup>[7](https://online.stat.psu.edu/stat500/Lesson09)</sup><sup> • </sup><sup>[6](https://people.duke.edu/~rnau/mathreg.htm)</sup> |
| 最优性 | 在模型假设下，最小二乘是无偏的，且在全部线性无偏估计量中方差最小（高斯–马尔可夫定理）<sup>[8](https://pages.stern.nyu.edu/~wgreene/Text/Edition8/PDF/M04_GREE1366_08_SE_C04.pdf)</sup> |
| 主要弱点 | 一两个离群值即可严重扭曲最小二乘分析<sup>[2](https://www.itl.nist.gov/div898/handbook/pmd/section1/pmd141.htm)</sup> |

## 模型及其假设

模型将每个观测写成 \( y_i = \beta_0 + \beta_1 x_i + \varepsilon_i \)，其中 \( \beta_0 \) 为截距，\( \beta_1 \) 为斜率，\( \varepsilon_i \) 为随机误差。斜率为零意味着变量之间没有线性关联<sup>[3](https://pmc.ncbi.nlm.nih.gov/articles/PMC7462673/)</sup>。

四条假设保障估计值及建立在其上的推断<sup>[7](https://online.stat.psu.edu/stat500/Lesson09)</sup>：

1. **线性性**：y 的条件均值是 x 的线性函数。
2. **独立性**：误差彼此独立。
3. **等方差性（同方差性）**：误差的条件方差对 x 的所有取值都相同。
4. **正态性**：残差近似服从正态分布。

第五个条件——条件均值为零 \( E[\varepsilon \mid x] = 0 \)——是无偏性的核心要求。当它不成立时，普通最小二乘法（OLS）通常有偏，问题变为内生性，需要采用工具变量等方法<sup>[9](https://www.luischanci.com/documents/Econometrics/OLS.pdf)</sup>。

违反假设的后果各不相同。当条件均值为零成立且标准正则条件适用时，异方差和自相关可使 OLS 点估计保持无偏和一致，但会使传统协方差估计量不一致，因此 t 统计量和 F 统计量失去其名义分布，即使在大样本中推断也会产生误导<sup>[10](https://ijiemr.org/public/uploads/paper/597081789722100.pdf)</sup>。正态性仅为精确的有限样本推断所需；缺乏正态性时，OLS 在线性估计量中仍保持其高斯–马尔可夫最优性<sup>[10](https://ijiemr.org/public/uploads/paper/597081789722100.pdf)</sup>。最近对十四篇使用线性回归的健康与生物医学论文的再分析发现，仅有三篇在推断上可复现，其中正态性和独立性是最常被违反的假设，各有八篇论文违反<sup>[11](https://www.medrxiv.org/content/10.64898/2026.04.07.26350296v1)</sup>。

## 最小二乘拟合

最小二乘准则选择使

\[ Q = \sum_{i=1}^{n} \left( y_i - \beta_0 - \beta_1 x_i \right)^2 \]

最小的系数，其中 Q 是各点到直线的垂直残差平方和<sup>[4](https://www.itl.nist.gov/div898/handbook/pmd/section4/pmd431.htm)</sup><sup> • </sup><sup>[12](https://nasyring.github.io/Introduction-to-Statistical-Inference/simple-linear-regression.html)</sup>。对于线性模型，最小化通过微积分解析完成，得到正规方程和闭式估计量<sup>[4](https://www.itl.nist.gov/div898/handbook/pmd/section4/pmd431.htm)</sup>：

\[ \hat{\beta}_1 = \frac{\sum_{i=1}^{n} (x_i - \bar{x})(y_i - \bar{y})}{\sum_{i=1}^{n} (x_i - \bar{x})^2}, \qquad \hat{\beta}_0 = \bar{y} - \hat{\beta}_1 \bar{x}. \]

斜率也可等价地写为 \( b_1 = r \cdot s_y / s_x \)，即皮尔逊相关系数乘以 y 的标准差与 x 的标准差之比<sup>[13](https://online.stat.psu.edu/stat200/book/export/html/244)</sup>。

残差方差由均方误差估计，\( \mathrm{MSE} = \mathrm{SSE}/(n-2) \)，因为 \( E(\mathrm{SSE}) = (n-2)\sigma^2 \)；两个自由度用于估计截距和斜率<sup>[5](https://stats.libretexts.org/Bookshelves/Computing_and_Modeling/Supplemental_Modules_(Computing_and_Modeling)/Regression_Analysis/Simple_linear_regression/Simple_Linear_Regression_(with_one_predictor))</sup>。若改为除以 n（如最大似然估计量所做的那样），则得到 \( \sigma^2 \) 的有偏估计<sup>[14](https://viva.pressbooks.pub/statisticalmodelingleemis/chapter/chapter-2-inference-in-simple-linear-regression/)</sup>。

**高斯–马尔可夫最优性。** 在给定回归矩阵的线性回归模型中，最小二乘估计量是系数的最小方差线性无偏估计量，任何线性组合 \( w'\hat{\beta} \) 都是 \( w'\beta \) 的最小方差线性无偏估计量<sup>[8](https://pages.stern.nyu.edu/~wgreene/Text/Edition8/PDF/M04_GREE1366_08_SE_C04.pdf)</sup>。高斯于 1823 年提出的正是这个问题：哪个线性无偏估计量方差最小；该结果不依赖于正态性<sup>[15](https://link.springer.com/article/10.1007/s00407-022-00291-w)</sup>。

## 推断：标准误、置信区间与预测区间

回归标准误 \( \mathrm{SE} = \sqrt{\sum (y_i - \hat{y}_i)^2 / (n-2)} \) 是噪声标准差 \( \sigma \) 的估计<sup>[16](https://stattrek.com/regression/linear-regression?tutorial=reg)</sup><sup> • </sup><sup>[6](https://people.duke.edu/~rnau/mathreg.htm)</sup>。对于可比设计，系数的标准误与该量成正比，并大致与 \( \sqrt{n} \) 成反比，因此四倍的数据量可将其减小约一半<sup>[6](https://people.duke.edu/~rnau/mathreg.htm)</sup>。

斜率的检验统计量为 \( t = \hat{\beta}_1 / \mathrm{SE}(\hat{\beta}_1) \)，在正态误差假设下服从自由度为 \( n-2 \) 的 t 分布，斜率的 \( 100(1-\alpha)\% \) 置信区间为 \( \hat{\beta}_1 \pm t_{\alpha/2,\,n-2} \cdot \mathrm{SE}(\hat{\beta}_1) \)<sup>[7](https://online.stat.psu.edu/stat500/Lesson09)</sup><sup> • </sup><sup>[17](https://www.stat.purdue.edu/~fmliang/STAT611/st611lect11.pdf)</sup>。

**两种不同的区间。** 在新 \( x_0 \) 处的置信区间覆盖平均响应 \( \beta_0 + \beta_1 x_0 \)；预测区间覆盖单个新观测。预测误差的方差为

\[ \sigma^2 \left( 1 + \frac{1}{n} + \frac{(x_0 - \bar{x})^2}{\sum (x_i - \bar{x})^2} \right), \]

因此预测区间为 \( \hat{y}_0 \pm t_{\alpha/2,\,n-2} \cdot \sqrt{\mathrm{MSE}\left(1 + \frac{1}{n} + \frac{(x_0 - \bar{x})^2}{S_{xx}}\right)} \)<sup>[12](https://nasyring.github.io/Introduction-to-Statistical-Inference/simple-linear-regression.html)</sup><sup> • </sup><sup>[17](https://www.stat.purdue.edu/~fmliang/STAT611/st611lect11.pdf)</sup>。两个区间中心相同，但预测区间总是更宽，因为估计单个值比估计均值更难<sup>[7](https://online.stat.psu.edu/stat500/Lesson09)</sup>。额外的“1”项反映了新观测自身的方差，这正是预测标准误以模型标准误为下界、且不会随数据增多而系统性缩小的原因<sup>[6](https://people.duke.edu/~rnau/mathreg.htm)</sup>。

## 拟合优度与诊断

\( R^2 \) 是响应变量中可由预测变量预测的方差比例：\( R^2 \) 为 0.10 意味着 y 中 10% 的方差可由 x 预测<sup>[16](https://stattrek.com/regression/linear-regression?tutorial=reg)</sup>。在简单线性回归中 \( R^2 = r^2 \)，即相关系数的平方；若相关系数为 0.5，则模型解释 y 中 25% 的方差<sup>[7](https://online.stat.psu.edu/stat500/Lesson09)</sup><sup> • </sup><sup>[6](https://people.duke.edu/~rnau/mathreg.htm)</sup>。当所有点都在一条直线上时 \( R^2 \) 等于 1，当预测变量无助于预测响应变量时 \( R^2 \) 为 0<sup>[18](https://ovolpe.github.io/files/teaching/lecture5-6.pdf)</sup>。

\( R^2 \) 并不衡量线性模型是否合适：即使 y 与 x 呈非线性关系，\( R^2 \) 也可能很大<sup>[17](https://www.stat.purdue.edu/~fmliang/STAT611/st611lect11.pdf)</sup>，且它对因果关系一无所言<sup>[18](https://ovolpe.github.io/files/teaching/lecture5-6.pdf)</sup>。在分析校准中，即使满足 \( r^2 \) 标准，较低浓度水平也可能无法通过重拟合标准（偏差低于 20%），因此仅依赖 \( r^2 \) 的分析人员可能遗漏低浓度水平的问题<sup>[19](https://www.azdhs.gov/documents/preparedness/state-laboratory/lab-licensure-certification/technical-resources/calibration-training/08-linear-least-square-regression-calib.pdf)</sup>。

**残差图**可诊断假设失效：弯曲提示均值函数不合适，扇形或领结形图案提示方差不恒定，大残差指示离群值<sup>[7](https://online.stat.psu.edu/stat500/Lesson09)</sup><sup> • </sup><sup>[20](https://www.stat.purdue.edu/~fmliang/STAT512/lect2.pdf)</sup>。

**杠杆与影响。** 某点的杠杆为 \( 1/n + (x - \bar{x})^2 / \sum (x_i - \bar{x})^2 \)；它仅反映 x 方向上的离群程度，杠杆越大意味着对最小二乘直线的潜在影响越大，而该直线必过 \( (\bar{x}, \bar{y}) \)<sup>[21](https://people.stat.sc.edu/gregorkb/STAT_516_fa_2026/STAT_516_Lec_02_annotated.pdf)</sup>。库克距离衡量每个数据点对拟合的改变程度，计算为杠杆与学生化残差（数据点残差除以其估计标准差）的平方的函数；数值远大于其他观测的观测应予仔细检查或剔除<sup>[21](https://people.stat.sc.edu/gregorkb/STAT_516_fa_2026/STAT_516_Lec_02_annotated.pdf)</sup><sup> • </sup><sup>[22](https://stat.ethz.ch/education/semesters/ss2014/regression/Regression.pdf)</sup>。有影响的观测是指其移除会显著改变回归方程的观测<sup>[7](https://online.stat.psu.edu/stat500/Lesson09)</sup>。这种敏感性是结构性的：平方误差准则允许单个观测对系数施加无界影响<sup>[10](https://ijiemr.org/public/uploads/paper/597081789722100.pdf)</sup>，一两个离群值即可严重扭曲最小二乘分析<sup>[2](https://www.itl.nist.gov/div898/handbook/pmd/section1/pmd141.htm)</sup>。

## 精度与样本量：用数字说话

三条缩放规则概括了简单回归所能提供的东西。第一，对于可比设计，系数精度大致随样本量的平方根提高：数据量增至四倍约可将标准误减半<sup>[6](https://people.duke.edu/~rnau/mathreg.htm)</sup>。第二，\( R^2 \) 以二次方式将相关性转换为解释方差，因此 0.5 的中等相关仅对应 25% 的解释方差<sup>[6](https://people.duke.edu/~rnau/mathreg.htm)</sup>。第三，预测精度有下限：无论收集多少数据，预测标准误永远不能低于模型标准误 \( \sigma \)，因为新观测带有其自身不可约的噪声<sup>[6](https://people.duke.edu/~rnau/mathreg.htm)</sup>。

## 与相关方法的比较

**回归与相关。** 相关衡量双向线性关联的强度，尺度从 −1 到 1，通常解读为弱（\( r < \pm 0.4 \)）、中等（\( \pm 0.4 \) 至 \( \pm 0.7 \)）和强（\( r > \pm 0.7 \)）<sup>[3](https://pmc.ncbi.nlm.nih.gov/articles/PMC7462673/)</sup>。当一个变量是结果而另一个是预测变量时，应使用回归；两个变量不可互换，且相关不意味着因果<sup>[3](https://pmc.ncbi.nlm.nih.gov/articles/PMC7462673/)</sup>。两者相互联系：斜率等于 \( r \cdot s_y / s_x \)，且 \( R^2 = r^2 \)<sup>[13](https://online.stat.psu.edu/stat200/book/export/html/244)</sup><sup> • </sup><sup>[7](https://online.stat.psu.edu/stat500/Lesson09)</sup>。

**多元回归。** 当预测变量多于一个时，只要加入额外的回归变量，\( R^2 \) 就不会减小，无论该回归变量是否有信息量，这促使了调整后的 \( R^2 \) 的出现<sup>[9](https://www.luischanci.com/documents/Econometrics/OLS.pdf)</sup>。

**t 检验与方差分析。** t 检验比较两个样本组的均值，单因素方差分析比较多于两组的均值，后者还要求方差齐性；相关描述变量之间的关联，而回归将结果建模为预测变量的函数<sup>[23](https://kandadata.com/determine-regression-correlation-or-difference-test/)</sup>。

**稳健与非参数替代方法。** 最小二乘不稳健：重尾误差分布会严重降低其性能，且估计值对个别离群值极为敏感<sup>[22](https://stat.ethz.ch/education/semesters/ss2014/regression/Regression.pdf)</sup>。Theil–Sen 估计量是由亨利·泰尔和普拉纳布·森开发的基于中位数的方法，是标准的稳健替代方法；它甚至已被适配到差分隐私设定，其中基于中位数的算法在经验上优于标准的差分隐私方法<sup>[24](https://crysp.petsymposium.org/popets/2025/popets-2025-0013.pdf)</sup>。也有人提出了 \( R^2 \) 的稳健版本，包括基于最小加权二乘估计量的版本，在 29 个公开数据集上显示出普遍更窄的置信区间<sup>[25](https://link.springer.com/article/10.21136/AM.2025.0105-25)</sup>。当假设失效时，推荐的替代方法包括稳健方法、自助法、广义线性模型或混合效应模型<sup>[11](https://www.medrxiv.org/content/10.64898/2026.04.07.26350296v1)</sup>。

## 历史、陷阱与现代实践

阿德里安-马里·勒让德于 1805 年发表了带正规方程的最小二乘法。四年后，卡尔·弗里德里希·高斯用条件正态模型从概率角度处理该问题，并证明最大似然给出勒让德的最小二乘解<sup>[26](https://mlysy.github.io/stat331/simple-linear-regression.html)</sup>。高斯于 1821–1823 年以加权最小二乘法重返该问题<sup>[27](https://www.sciencedirect.com/science/article/pii/S0377042700003435)</sup>，其 1823 年的方差问题产生了高斯–马尔可夫定理<sup>[15](https://link.springer.com/article/10.1007/s00407-022-00291-w)</sup>。

**向均值回归。** “回归”一词源于弗朗西斯·高尔顿（1811–1911），他是查尔斯·达尔文的表弟<sup>[28](https://www.le.ac.uk/economics/research/RePEc/lec/leecon/dp14-05.pdf)</sup>。高尔顿最早有记载的香豌豆研究表明亲子斜率为 0.33，说明极大或极小的母种子通常产生远不那么极端的子种子；对高尔顿而言，任何小于 1.0 的斜率都表明该世代向均值回归<sup>[29](https://www.tandfonline.com/doi/full/10.1080/10691898.2001.11910537)</sup>。

**陷阱。** 简单回归的常见滥用包括超出回归变量范围的外推、斜率对远端 x 值的敏感性、离群值对拟合的干扰，以及将相关视为必然；回归处理的是相关，本身不能确立因果<sup>[17](https://www.stat.purdue.edu/~fmliang/STAT611/st611lect11.pdf)</sup>。

**标准与应用。** ASTM E3080 是单预测变量回归分析的标准实践，所列用途包括描述变量关系、预测未来值、将测试方法精度与被测特性关联，以及开发过程控制方法<sup>[30](https://store.astm.org/e3080-23.html)</sup>。ISO 11095:1996 规定了使用标准物质估计线性校准函数的基本方法，及其扩展使用的控制方法<sup>[31](https://www.iso.org/standard/1060.html)</sup>。在医学研究中，简单线性回归用于测量预测变量与结果变量之间的线性关系<sup>[32](https://pubs.rsna.org/doi/10.1148/radiol.2273011499)</sup>。

## References

1. [Regression Models and Their Uses, ETSU course notes](https://faculty.etsu.edu/gardnerr/5710/notes-Linear-Models1/Linear-Models1-1-2.pdf)
2. [NIST/SEMATECH e-Handbook 4.1.4.1 Linear Least Squares Regression](https://www.itl.nist.gov/div898/handbook/pmd/section1/pmd141.htm)
3. [Correlation vs. regression in association studies, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC7462673/)
4. [NIST/SEMATECH e-Handbook 4.4.3.1 Least Squares](https://www.itl.nist.gov/div898/handbook/pmd/section4/pmd431.htm)
5. [Simple Linear Regression (with one predictor), Statistics LibreTexts](https://stats.libretexts.org/Bookshelves/Computing_and_Modeling/Supplemental_Modules_(Computing_and_Modeling)/Regression_Analysis/Simple_linear_regression/Simple_Linear_Regression_(with_one_predictor))
6. [Mathematics of Simple Regression, Robert Nau, Duke University](https://people.duke.edu/~rnau/mathreg.htm)
7. [Linear Regression Foundations, STAT 500, Penn State](https://online.stat.psu.edu/stat500/Lesson09)
8. [Gauss–Markov Theorem, Greene, Econometric Analysis, 8th ed., Ch. 4](https://pages.stern.nyu.edu/~wgreene/Text/Edition8/PDF/M04_GREE1366_08_SE_C04.pdf)
9. [Ordinary Least Squares (OLS) econometrics notes](https://www.luischanci.com/documents/Econometrics/OLS.pdf)
10. [OLS assumptions and consequences of assumption failure, IJIEMR (2026)](https://ijiemr.org/public/uploads/paper/597081789722100.pdf)
11. [An Empirical Assessment of Inferential Reproducibility of Linear Regression, medRxiv (2026)](https://www.medrxiv.org/content/10.64898/2026.04.07.26350296v1)
12. [Chapter 8: Simple Linear Regression, A First Course in Probability and Statistics](https://nasyring.github.io/Introduction-to-Statistical-Inference/simple-linear-regression.html)
13. [PSU STAT 200, Section 12.3 Simple Linear Regression](https://online.stat.psu.edu/stat200/book/export/html/244)
14. [Chapter 2: Inference in Simple Linear Regression, Statistical Modeling (Leemis)](https://viva.pressbooks.pub/statisticalmodelingleemis/chapter/chapter-2-inference-in-simple-linear-regression/)
15. [Gauss on least-squares and maximum-likelihood estimation, Archive for History of Exact Sciences (2022)](https://link.springer.com/article/10.1007/s00407-022-00291-w)
16. [Linear Regression, Stat Trek](https://stattrek.com/regression/linear-regression?tutorial=reg)
17. [STAT 611 Lecture 11: Simple Linear Regression, Purdue University](https://www.stat.purdue.edu/~fmliang/STAT611/st611lect11.pdf)
18. [Lectures 5 & 6, Simple Linear Regression](https://ovolpe.github.io/files/teaching/lecture5-6.pdf)
19. [Linear Calibration Using Least Square Regression, Arizona Department of Health Services](https://www.azdhs.gov/documents/preparedness/state-laboratory/lab-licensure-certification/technical-resources/calibration-training/08-linear-least-square-regression-calib.pdf)
20. [Chapter 2: Simple Linear Regression, Purdue STAT 512](https://www.stat.purdue.edu/~fmliang/STAT512/lect2.pdf)
21. [Review of simple linear regression, University of South Carolina STAT 516](https://people.stat.sc.edu/gregorkb/STAT_516_fa_2026/STAT_516_Lec_02_annotated.pdf)
22. [Regression lecture notes, ETH Zürich](https://stat.ethz.ch/education/semesters/ss2014/regression/Regression.pdf)
23. [How to Choose Regression, Correlation, or Difference Test, Kanda Data](https://kandadata.com/determine-regression-correlation-or-difference-test/)
24. [Analyzing the Differentially Private Theil–Sen Estimator for Simple Linear Regression, PoPETs (2025)](https://crysp.petsymposium.org/popets/2025/popets-2025-0013.pdf)
25. [A robust coefficient of determination based on implicit weighting, Applications of Mathematics (2025)](https://link.springer.com/article/10.21136/AM.2025.0105-25)
26. [Simple Linear Regression, STAT 331: Applied Linear Models](https://mlysy.github.io/stat331/simple-linear-regression.html)
27. [A tutorial history of least squares with applications to astronomy and geodesy](https://www.sciencedirect.com/science/article/pii/S0377042700003435)
28. [Econometrics: An Historical Guide for the Uninitiated, University of Leicester working paper](https://www.le.ac.uk/economics/research/RePEc/lec/leecon/dp14-05.pdf)
29. [Galton, Pearson, and the Peas: A Brief History of Linear Regression, Journal of Statistics Education](https://www.tandfonline.com/doi/full/10.1080/10691898.2001.11910537)
30. [ASTM E3080 Standard Practice for Regression Analysis with a Single Predictor Variable](https://store.astm.org/e3080-23.html)
31. [ISO 11095:1996 Linear calibration using reference materials](https://www.iso.org/standard/1060.html)
32. [Correlation and Simple Linear Regression, Radiology](https://pubs.rsna.org/doi/10.1148/radiol.2273011499)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Statistical inference, estimation, sampling, and testing › Regression analysis

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/simple-linear-regression

English original: https://www.edgepedia.org/simple-linear-regression
