# 加权回归（统计学）

加权回归，最常见的是加权最小二乘法（WLS），通过在拟合准则中为每个观测值赋予各自非负的权重来拟合回归模型，从而让携带更多信息的观测值占有更大的分量。

当普通最小二乘法（OLS）关于误差方差恒定的假设不成立时——这种情形称为异方差性——加权回归便是标准的补救办法：观测值 \( i \) 的权重取其误差方差的倒数，即 \( w_{i} = 1/\sigma_{i}^{2} \)，汇集为对角矩阵 \( W \)。<sup>[1](https://online.stat.psu.edu/stat501/book/export/html/990)</sup> 误差方差小的观测值获得较大的权重，因为它包含相对更多的信息；而权重只需已知到一个比例常数即可。<sup>[2](https://online.stat.psu.edu/stat462/node/186/)</sup> 在异方差条件下，WLS 是最佳线性无偏估计量（BLUE），但它几乎总是不可行的，因为方差未知，这就促使了可行加权最小二乘法（FWLS）的产生。<sup>[3](https://uwcscholar.uwc.ac.za:8443/server/api/core/bitstreams/c0a3e0a0-9157-4414-b511-286cd291f56b/content)</sup> 早期计量经济学家开出的正是这剂药方：对条件异方差性的函数形式建模，对响应变量和回归变量同时重新加权，再对变换后的数据运行 OLS。<sup>[4](https://www.sciencedirect.com/science/article/abs/pii/S030440761630197X)</sup> 同样的加权思想也适用于参数线性或非线性的函数。<sup>[5](https://www.itl.nist.gov/div898/handbook/pmd/section1/pmd143.htm)</sup>

| 关键事实 | 详情 |
|---|---|
| 何时使用 | 误差方差不恒定（异方差性）、观测精度各异，或必须反映抽样设计时。<sup>[1](https://online.stat.psu.edu/stat501/book/export/html/990)</sup> |
| 估计量 | \( \hat{\beta}_{\mathrm{WLS}} = (X^{\mathrm{T}}WX)^{-1}X^{\mathrm{T}}WY \)，即最小化加权残差平方和。<sup>[2](https://online.stat.psu.edu/stat462/node/186/)</sup> |
| 权重选择 | 权重与（先验）方差的倒数成比例；一种常见约定是 \( p_{i}\sigma_{i}^{2} = \sigma_{0}^{2} \)，因而 \( \sigma_{i}^{2} = \sigma_{0}^{2}/p_{i} \)。<sup>[6](https://www2.imm.dtu.dk/pubdb/edoc/imm2804.pdf)</sup> |
| 与 OLS 的关系 | WLS 等价于对白化数据做 OLS，即以 \( P^{1/2}X \) 替换 \( X \)，以 \( P^{1/2}y \) 替换 \( y \)。<sup>[6](https://www2.imm.dtu.dk/pubdb/edoc/imm2804.pdf)</sup> |
| 软件 | 在 R 中，当把方差倒数的向量作为 `weights` 传入时，`lm` 执行 WLS；所有权重默认为 1 时即为 OLS。<sup>[7](https://stats.libretexts.org/Courses/Knox_College/Linear_Models_and_Rurita_Kralovstvi/10%3A_Other_Least_Squares/10.02%3A_Weighted_Least_Squares)</sup> |
| 抽样权重 | 在一项研究中，将抽样权重直接应用于正规方程产生了有偏估计（75.78 对 70.86）；建议改用抽样权重的正平方根。<sup>[8](http://www.asasrms.org/Proceedings/y2013/files/308377_80748.pdf)</sup> |
| 典型效果 | WLS 的系数估计通常与未加权的 OLS 估计几乎相同；实际的困难在于估计误差方差。<sup>[1](https://online.stat.psu.edu/stat501/book/export/html/990)</sup> |

## 工作原理

WLS 最小化加权残差平方和。给定权重矩阵 \( W \)，估计值是最小化 \( (y - Ax)^{\mathrm{T}}W(y - Ax) \) 的解，由此得到加权正规方程 \( A^{\mathrm{T}}WA\,x = A^{\mathrm{T}}W\,y \)，其解为 \( \hat{x} = (A^{\mathrm{T}}WA)^{-1}A^{\mathrm{T}}W\,y \)。<sup>[6](https://www2.imm.dtu.dk/pubdb/edoc/imm2804.pdf)</sup><sup> • </sup><sup>[9](https://mude.citg.tudelft.nl/book/2024/observation_theory/03_WeightedLSQ.html)</sup> 等价地，对于协方差矩阵为 \( V \) 的多元线性回归，最小化加权残差平方和 \( \mathrm{wRSS}(\beta) = \sum_{i=1}^{n}(W\varepsilon)_{i}^{2} \) 的参数为 \( \hat{\beta} = (X^{\mathrm{T}}V^{-1}X)^{-1}X^{\mathrm{T}}V^{-1}y \)。<sup>[10](https://statproofbook.github.io/P/mlr-wls2.html)</sup>

以 \( P^{1/2}X \) 替换 \( X \)、以 \( P^{1/2}y \) 替换 \( y \)，便将 WLS 问题转化为 OLS 问题。<sup>[6](https://www2.imm.dtu.dk/pubdb/edoc/imm2804.pdf)</sup> 在简单回归的表述中，权重矩阵可写成矩阵平方根的形式，\( W = V^{-1/2} \)，从而 \( V^{-1} = W \cdot W \)。<sup>[11](https://statproofbook.github.io/P/slr-wls.html)</sup> 广义最小二乘法（GLS）将其推广到已知的、对称正定的完整矩阵 \( \Sigma \)，允许误差既相关又方差不等；将模型左乘 \( \Sigma^{-1/2} \) 可对误差去相关并标准化，\( \Sigma^{-1/2}E \sim N(0, \sigma^{2}I) \)，并得到 \( b_{\mathrm{GLS}} = (X'\Sigma^{-1}X)^{-1}X'\Sigma^{-1}Y \)。<sup>[12](https://stats.libretexts.org/Courses/Knox_College/Linear_Models_and_Rurita_Kralovstvi/10%3A_Other_Least_Squares/10.03%3A_Generalized_Least_Squares)</sup>

## 操作步骤

工作流程是：选择方差结构、导出权重、拟合，并可选地迭代。

1. **已知方差。** 权重取与每个观测值的期望（先验）方差倒数成比例。<sup>[6](https://www2.imm.dtu.dk/pubdb/edoc/imm2804.pdf)</sup> 对于泊松型数据，若 \( \mathrm{Var}(Y \mid X = x) \) 随 \( x \) 增大，可采用 \( w_{i} = 1/x_{i} \)。<sup>[13](https://ms.mcmaster.ca/canty/teaching/stat3a03/Lectures7.pdf)</sup>
2. **方差函数估计。** 通常 \( W \) 的结构未知，因此先运行 OLS 拟合，用其残差平方或绝对残差来估计方差或标准差函数，再由此导出权重。<sup>[2](https://online.stat.psu.edu/stat462/node/186/)</sup> 在方差模型 \( \mathrm{Var}(y_{i}) = \sigma_{i}^{2} = h(z_{i}'\theta) \) 中，可先对 OLS 残差做非线性最小二乘来估计参数 \( \theta \)，再执行可行 WLS。<sup>[14](https://eml.berkeley.edu/~powell/e240b_sp06/hetnotes.pdf)</sup>
3. **重复观测。** 在有重复试验的设计实验中，每个固定协变量向量处 \( Y \) 的方差可直接由样本方差估计，并以该估计方差的倒数作为权重。<sup>[13](https://ms.mcmaster.ca/canty/teaching/stat3a03/Lectures7.pdf)</sup><sup> • </sup><sup>[27](https://www.itl.nist.gov/div898/handbook/pmd/section4/pmd452.htm)</sup>
4. **迭代。** 当 OLS 与 WLS 的系数估计差异较大时，可迭代该过程直至系数稳定，通常不超过一两次迭代；这就是迭代重加权最小二乘法。<sup>[2](https://online.stat.psu.edu/stat462/node/186/)</sup>
5. **软件。** R 的 `lm` 在提供方差倒数权重时执行 WLS。<sup>[7](https://stats.libretexts.org/Courses/Knox_College/Linear_Models_and_Rurita_Kralovstvi/10%3A_Other_Least_Squares/10.02%3A_Weighted_Least_Squares)</sup>

## 起源

十八世纪初，一种为观测值赋予权重的广义观测组合方法被引入。<sup>[15](https://hedibert.org/wp-content/uploads/2016/08/plackett1972-thediscoveryofthemethodofleastsquares.pdf)</sup> 最小二乘法通过最小化残差平方和来确定参数，它可由高斯分布经拉普拉斯的逆概率原理推导得出。<sup>[16](https://wolberg.net.technion.ac.il/files/2017/03/history.pdf)</sup><sup> • </sup><sup>[17](https://rwr.nrhstat.org/1_introduction.html)</sup> 尽管高斯自约 1795 年起便使用该方法，但勒让德 1805 年的论述在先，而高斯后来提及自己更早的工作，引发了关于优先权的大量争议。<sup>[15](https://hedibert.org/wp-content/uploads/2016/08/plackett1972-thediscoveryofthemethodofleastsquares.pdf)</sup> 高斯在假定方差已知的前提下考虑了精度差异，并以权重推广了他的方法。<sup>[8](http://www.asasrms.org/Proceedings/y2013/files/308377_80748.pdf)</sup> 高斯–马尔可夫定理确定了方差最小的线性无偏估计量，且不依赖于误差的正态性。<sup>[18](https://link.springer.com/article/10.1007/s00407-022-00291-w)</sup>

## 变体

**迭代（I）WLS。** 非线性回归模型在广义线性模型框架下得到统一，最大似然估计量可通过费希尔得分法计算，其每一步都求解一个加权最小二乘问题；这就是迭代加权最小二乘法（IWLS）算法。<sup>[17](https://rwr.nrhstat.org/1_introduction.html)</sup> P. J. Green（1984 年，《皇家统计学会杂志 B 辑》）将用于最大似然估计的迭代重加权最小二乘法的处理推广到其他分布、非线性参数化以及相依观测，并在可用准则中给出了最大似然的抗差替代方案。<sup>[19](https://doi.org/10.1111/j.2517-6161.1984.tb01288.x)</sup>

**加权非线性回归。** 由于 WLS 将权重纳入拟合准则，它既适用于参数线性的函数，也适用于参数非线性的函数。<sup>[5](https://www.itl.nist.gov/div898/handbook/pmd/section1/pmd143.htm)</sup>

**加权平均最小二乘法。** `wals` 命令推出了 3.0 版，其中 `hetwals` 和 `glmwals` 命令扩大了这一模型平均方法所能拟合的模型类别。<sup>[20](https://research.vu.nl/en/publications/weighted-average-least-squares-beyond-the-classical-linear-regres/)</sup>

## 应用

**抽样加权回归。** 抽样权重用于处理不等选择概率、抽样框覆盖误差和无应答；在适当场合不加权可能导致有偏估计，而不必要的加权则会产生效率低下的估计量，且并不能减少偏差。<sup>[21](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-011516-012958)</sup> 基于设计的权重通常是选择概率的倒数，经无应答调整，并辅以后分层或校准调整以及权重截断，以限制不等加权效应。<sup>[22](https://unstats.un.org/unsd/hhsurveys/pdf/Chapter_19.pdf)</sup>

**实践中的精度加权。** 在 R 中，当把方差倒数的向量作为 `weights` 传入时，`lm` 执行 WLS；所有权重默认为 1 时即为 OLS。<sup>[7](https://stats.libretexts.org/Courses/Knox_College/Linear_Models_and_Rurita_Kralovstvi/10%3A_Other_Least_Squares/10.02%3A_Weighted_Least_Squares)</sup>

## 局限与替代方法

**估计权重会膨胀方差。** 当样本方差基于 \( m \) 次重复观测时，即使数据服从正态分布，使用估计权重的 WLS 在 \( m = 2 \) 时也不一致；当 \( m > 6 \) 时，估计权重会使方差相对于已知权重的 WLS 增大 \( (m-5)/(m-3) \) 倍。<sup>[23](https://people.tamu.edu/~dcline/Papers/weightedleastsquares.pdf)</sup>

**抽样权重不是精度权重。** 在 2009–2010 年 NHANES 数据上，将抽样权重直接应用于正规方程产生了有偏估计（75.78 对 70.86），错误的权重形式导致了错误的研究结论。<sup>[8](http://www.asasrms.org/Proceedings/y2013/files/308377_80748.pdf)</sup> 在通常的外生性和正则性假设下，权重仅依赖于已观测自变量的加权 OLS 是无偏且一致的；当误差存在异方差时，权重与误差方差成反比可得到比未加权 OLS 更精确的参数估计。<sup>[24](https://scholar.harvard.edu/files/cwinship/files/sampling_weights.pdf)</sup><sup> • </sup><sup>[5](https://www.itl.nist.gov/div898/handbook/pmd/section1/pmd143.htm)</sup>

**模型设定错误。** 罗马诺和沃尔夫（2017）表明，即使重加权模型设定错误，基于 WLS 的渐近有效推断仍可行，因为可以在不知道条件异方差函数形式的情况下使用异方差稳健标准误；设定错误的权重使 WLS 保持一致性但不再是 BLUE，常规置信区间缺乏正确的覆盖率。<sup>[4](https://www.sciencedirect.com/science/article/abs/pii/S030440761630197X)</sup> 若异方差的形式设定错误（\( \sigma_{i}^{2} \neq \sigma^{2}h(z_{i}'\theta) \)），则通常的 WLS 协方差估计量不一致，不过只要线性模型正确，可行 WLS 估计量仍渐近正态。<sup>[14](https://eml.berkeley.edu/~powell/e240b_sp06/hetnotes.pdf)</sup>

**标准误。** 直接代入的 WLS 标准误覆盖率常低于名义水平，尤其在小样本中；在未知异方差下，检验的拒绝率可能高于名义水平。<sup>[25](https://www.econ.uzh.ch/dam/jcr:7dc1dadd-8515-47af-a9e9-77d19a38faa1/econStat_2019.pdf)</sup> 即便无偏方差估计的倒数也是有偏的：在正态性下 \( \mathrm{E}(\hat{\sigma}_{i}^{-2}) = \sigma_{i}^{-2}(n_{i} - r_{i})/(n_{i} - r_{i} - 2) \)。<sup>[26](https://www.sciencedirect.com/science/article/abs/pii/S0378375801002853)</sup>

**权重依赖于响应变量。** 当权重依赖于因变量从而依赖于误差项时，建议重新设定模型；若必须使用加权 OLS，则标准误的标准公式不正确，应改用怀特（1980）异方差稳健估计量。<sup>[24](https://scholar.harvard.edu/files/cwinship/files/sampling_weights.pdf)</sup>

**替代方法。** 异方差稳健方法分为两大类：应用于 OLS 的三明治法（异方差稳健协方差矩阵估计量，HCCME），以及参数方差建模；HCCME 在正则条件下一致地估计 \( \mathrm{Cov}(\hat{\beta}_{\mathrm{OLS}}) \) 并给出渐近有效的检验，而对响应变量做博克斯–考克斯变换可减轻异方差的后果。<sup>[3](https://uwcscholar.uwc.ac.za:8443/server/api/core/bitstreams/c0a3e0a0-9157-4414-b511-286cd291f56b/content)</sup> 艾克–怀特协方差估计量通常以 \( \hat{\Omega} = I \) 应用于最小二乘的异方差稳健协方差估计。<sup>[14](https://eml.berkeley.edu/~powell/e240b_sp06/hetnotes.pdf)</sup>

## References

1. [13.1 - Weighted Least Squares (STAT 501, Penn State)](https://online.stat.psu.edu/stat501/book/export/html/990)
2. [10.1 - Nonconstant Variance and Weighted Least Squares (STAT 462, Penn State)](https://online.stat.psu.edu/stat462/node/186/)
3. [A review and comparison of methods of parameter estimation and inference for heteroskedastic linear regression](https://uwcscholar.uwc.ac.za:8443/server/api/core/bitstreams/c0a3e0a0-9157-4414-b511-286cd291f56b/content)
4. [Resurrecting weighted least squares (Romano & Wolf, Journal of Econometrics, 2017)](https://www.sciencedirect.com/science/article/abs/pii/S030440761630197X)
5. [Weighted Least Squares Regression, NIST/SEMATECH e-Handbook](https://www.itl.nist.gov/div898/handbook/pmd/section1/pmd143.htm)
6. [Least Squares Adjustment: Linear and Nonlinear Weighted Regression Analysis (Technical University of Denmark)](https://www2.imm.dtu.dk/pubdb/edoc/imm2804.pdf)
7. [10.2: Weighted Least Squares, Statistics LibreTexts](https://stats.libretexts.org/Courses/Knox_College/Linear_Models_and_Rurita_Kralovstvi/10%3A_Other_Least_Squares/10.02%3A_Weighted_Least_Squares)
8. [Weighted Least Squares Estimation with Sampling Weights (JSM 2013, ASA Survey Research Methods)](http://www.asasrms.org/Proceedings/y2013/files/308377_80748.pdf)
9. [3.3. Weighted least-squares estimation, MUDE textbook (TU Delft, 2024)](https://mude.citg.tudelft.nl/book/2024/observation_theory/03_WeightedLSQ.html)
10. [Weighted least squares for multiple linear regression, The Book of Statistical Proofs](https://statproofbook.github.io/P/mlr-wls2.html)
11. [Weighted least squares for simple linear regression, The Book of Statistical Proofs](https://statproofbook.github.io/P/slr-wls.html)
12. [10.3: Generalized Least Squares, Statistics LibreTexts](https://stats.libretexts.org/Courses/Knox_College/Linear_Models_and_Rurita_Kralovstvi/10%3A_Other_Least_Squares/10.03%3A_Generalized_Least_Squares)
13. [Weighted Least Squares, STAT 3A03 lecture notes (McMaster University)](https://ms.mcmaster.ca/canty/teaching/stat3a03/Lectures7.pdf)
14. [Lecture notes on heteroskedasticity and Feasible WLS (J. Powell, UC Berkeley)](https://eml.berkeley.edu/~powell/e240b_sp06/hetnotes.pdf)
15. [Studies in the History of Probability and Statistics XXIX: The Discovery of the Method of Least Squares (R. L. Plackett)](https://hedibert.org/wp-content/uploads/2016/08/plackett1972-thediscoveryofthemethodofleastsquares.pdf)
16. [History of the Method of Least Squares (Wolberg, Technion)](https://wolberg.net.technion.ac.il/files/2017/03/history.pdf)
17. [Introduction – Regression with R (Fox)](https://rwr.nrhstat.org/1_introduction.html)
18. [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)
19. [P. J. Green (1984). Iteratively Reweighted Least Squares for Maximum Likelihood Estimation, and Some Robust and Resistant Alternatives. Journal of the Royal Statistical Society Series B (Statistical Methodology).](https://doi.org/10.1111/j.2517-6161.1984.tb01288.x)
20. [Weighted-average least squares: Beyond the classical linear regression model (VU institutional record, Stata Journal)](https://research.vu.nl/en/publications/weighted-average-least-squares-beyond-the-classical-linear-regres/)
21. [Are Survey Weights Needed? A Review of Diagnostic Tests in Regression Analysis (Annual Review of Statistics and Its Application)](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-011516-012958)
22. [Chapter XIX: Statistical analysis of survey data (UN)](https://unstats.un.org/unsd/hhsurveys/pdf/Chapter_19.pdf)
23. [An Asymptotic Theory for Weighted Least-Squares with Weights Estimated by Replication (Carroll & Cline)](https://people.tamu.edu/~dcline/Papers/weightedleastsquares.pdf)
24. [Sampling weights and regression analysis (Winship & Radbill)](https://scholar.harvard.edu/files/cwinship/files/sampling_weights.pdf)
25. [Improving weighted least squares inference (University of Zurich working paper)](https://www.econ.uzh.ch/dam/jcr:7dc1dadd-8515-47af-a9e9-77d19a38faa1/econStat_2019.pdf)
26. [Iterative weighted least-squares estimates in a heteroscedastic linear regression model (Computational Statistics & Data Analysis)](https://www.sciencedirect.com/science/article/abs/pii/S0378375801002853)
27. [4.4.5.2. Accounting for Non-Constant Variation Across the Data](https://www.itl.nist.gov/div898/handbook/pmd/section4/pmd452.htm)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026*

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

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/weighted-regression-statistics

English original: https://www.edgepedia.org/weighted-regression-statistics
