# 贝塞尔校正（Bessel's correction）

**贝塞尔校正**是在样本方差公式的分母中使用 \( n - 1 \) 而不是 \( n \)，使得当用样本均值代替真实总体均值时，所得统计量是总体方差的无偏估计量。<sup>[1](https://numpy.org/doc/stable/reference/generated/numpy.var.html)</sup> 校正后的样本方差为

\[ s^{2} = \frac{1}{n-1}\sum_{i=1}^{n}(x_i - \bar{x})^{2}, \]

其中 \( \bar{x} \) 是样本均值。这一名称是为了纪念德国天文学家、数学家弗里德里希·威廉·贝塞尔（Friedrich Wilhelm Bessel，1784年7月22日—1846年3月17日），尽管这个因子或许更应归功于卡尔·弗里德里希·高斯（Carl Friedrich Gauss），他早在1823年就在这一关联中使用了它。<sup>[2](https://proofwiki.org/wiki/Bessel%27s_Correction)</sup><sup> • </sup><sup>[3](https://mathworld.wolfram.com/BesselsCorrection.html)</sup>

| 关键事实 | 细节 |
|---|---|
| 定义 | 在样本方差中用除数 \( n - 1 \) 代替 \( n \)，从而得到总体方差 \( \sigma^{2} \) 的无偏估计量<sup>[1](https://numpy.org/doc/stable/reference/generated/numpy.var.html)</sup> |
| 所校正偏差的大小 | 未校正估计量的期望为 \( \left(\frac{n-1}{n}\right)\sigma^{2} \)，因此它以因子 \( (n-1)/n \) 低估了 \( \sigma^{2} \)<sup>[4](https://math.oxford.emory.edu/site/math117/besselCorrection/)</sup> |
| 归属 | 以弗里德里希·威廉·贝塞尔命名；肯尼与基平（Kenney and Keeping，1951）指出，这个因子或许更应归功于高斯，他早在1823年就使用了它<sup>[2](https://proofwiki.org/wiki/Bessel%27s_Correction)</sup><sup> • </sup><sup>[3](https://mathworld.wolfram.com/BesselsCorrection.html)</sup> |
| 软件默认值 | NumPy 默认 \( ddof = 0 \)（未校正），需要 \( ddof = 1 \) 才得到校正形式；R 的 `var()` 和 MATLAB 的 `var()` 默认使用 \( n-1 \) 分母<sup>[1](https://numpy.org/doc/stable/reference/generated/numpy.var.html)</sup><sup> • </sup><sup>[5](https://r-statistics.co/base-var-in-R.html)</sup><sup> • </sup><sup>[6](https://www.mathworks.com/help/matlab/ref/double.var.html)</sup> |
| 残余偏差 | 样本标准差是校正后方差的平方根，它仍是总体标准差的有偏估计量，因为平方根是非线性函数<sup>[7](https://convertitive.com/glossary/bessel-correction/)</sup> |
| 精度权衡 | 校正后的估计量虽然无偏，却不一定使均方误差最小；未校正版本方差更小，可能是更准确的选择<sup>[8](https://www.tandfonline.com/doi/full/10.1080/00031305.2026.2635650)</sup> |

## 为什么未校正方差有偏

当从样本估计总体方差 \( \sigma^{2} \) 时，若只是把总体规模 \( N \) 换成样本规模 \( n \)、把总体均值 \( \mu \) 换成样本均值 \( \bar{x} \)，并对样本求和，就得到一个有偏估计：<sup>[4](https://math.oxford.emory.edu/site/math117/besselCorrection/)</sup>

\[ s_{\mathrm{biased}}^{2} = \frac{1}{n}\sum_{i=1}^{n}(x_i - \bar{x})^{2}. \]

原因在于，样本观测值平均而言自然更接近由它们计算出来的样本均值，而不是总体均值，所以平均平方距离 \( (x - \bar{x})^{2} \) 会低估平均的 \( (x - \mu)^{2} \)。<sup>[4](https://math.oxford.emory.edu/site/math117/besselCorrection/)</sup> 极端情形可以说明这一点：当样本量 \( n = 1 \) 时，唯一的值就等于样本均值，因此未校正方差为 0；除非总体由完全相同的值组成，否则这显然是低估。<sup>[4](https://math.oxford.emory.edu/site/math117/besselCorrection/)</sup>

偏差可以被精确量化。记 \( \mathrm{Var}[\bar{x}] = \sigma^{2}/n \)，则未校正估计量的期望为<sup>[4](https://math.oxford.emory.edu/site/math117/besselCorrection/)</sup>

\[ E\left[s_{\mathrm{biased}}^{2}\right] = \sigma^{2} - \frac{\sigma^{2}}{n} = \left(\frac{n-1}{n}\right)\sigma^{2}. \]

另一种等价推导对每一项计算 \( E(X_i - \bar{X})^{2} = \frac{n-1}{n}\sigma^{2} \)，于是 \( n \) 个这样的项之和的期望为 \( (n-1)\sigma^{2} \)，再除以 \( n-1 \) 就恢复了 \( \sigma^{2} \)。<sup>[9](https://econweb.ucsd.edu/~gelliott/Chapter7SUnbiased.html)</sup> 样本越小，这种低估越明显；当 \( n = 5 \) 时，除以 5 而不是 4 会使方差低估 20%。<sup>[10](https://pages.cogsci.uos.de/rrawiel/introdeeplearning/practice/practice01-regression-classification/05-maximum-likelihood.html)</sup>

## 自由度

除数 \( n-1 \) 被描述为一种自由度校正：因为作为中心的样本均值本身是由数据估计出来的，所以损失了一个自由度。<sup>[11](https://www.itl.nist.gov/div898/handbook/toolaids/pff/E-Handbook.pdf)</sup> 如果总体均值 \( \mu \) 已知且精确，并改用其作为中心，那么估计量 \( \frac{1}{n}\sum_{i=1}^{n}(X_i - \mu)^{2} \) 已经无偏，不需要校正。<sup>[12](https://sgtcho.com/en/wiki/expectation-and-variance/)</sup>

对于正态样本，校正后的方差与卡方分布相联系：\( (n-1)s^{2}/\sigma^{2} \) 服从自由度为 \( n-1 \) 的卡方分布。<sup>[13](https://eml.berkeley.edu/~mcfadden/e240a_sp01/ch6.pdf)</sup> 这一关系是方差卡方检验的基础，其检验统计量为 \( T = (N-1)(s/\sigma_0)^{2} \)，自由度为 \( N-1 \)。<sup>[14](https://www.itl.nist.gov/div898/handbook/eda/section3/eda358.htm)</sup>

## 与最大似然的关系

对于均值和方差均未知的独立同分布正态样本，最大似然估计产生的方差估计以 \( n \) 为分母，即 \( \hat{\nu}^{2} = \frac{1}{n}\sum_{i=1}^{n}(x_i - \bar{x}_n)^{2} \)，它是有偏的；无偏版本则用 \( n-1 \) 代替 \( n \)。<sup>[15](https://www.stat.umn.edu/geyer/3701/notes/models2.html)</sup> 两者相差因子 \( n/(n-1) \)，当 \( n \) 很大时可以忽略。<sup>[15](https://www.stat.umn.edu/geyer/3701/notes/models2.html)</sup>

## 无偏性并非全部

**偏差与方差。** 无偏性只是若干性质之一。校正后的估计量 \( S_{n-1}^{2} \) 偏差为零，但方差更大；未校正的 \( S_{n}^{2} \) 有偏，但方差更小，因此，视样本量和总体分布而定，两者中的任何一个都可能具有更小的均方误差。<sup>[8](https://www.tandfonline.com/doi/full/10.1080/00031305.2026.2635650)</sup> 《美国统计学家》（*The American Statistician*）2026 年的一项分析发现，对于其所列出的所有分布，未校正样本方差的均方误差都小于校正后的样本方差，并且许多统计学教科书推荐贝塞尔校正的理由有些牵强。<sup>[8](https://www.tandfonline.com/doi/full/10.1080/00031305.2026.2635650)</sup> 新墨西哥大学（University of New Mexico）数学与统计学教授罗纳德·克里斯滕森（Ronald Christensen）针对该论文的评论发表在同一期刊上。<sup>[16](https://www.tandfonline.com/doi/full/10.1080/00031305.2026.2688548)</sup>

即便是校正后的方差也仍留下偏差：开平方是非线性运算，因此根据詹森（Jensen）不等式，基于贝塞尔校正方差的样本标准差仍是总体标准差的一个略有偏的估计量。<sup>[7](https://convertitive.com/glossary/bessel-correction/)</sup> 对于正态总体，\( \sigma \) 的无偏估计量则是对 \( s \) 施加因子 \( \sqrt{(n-1)/2}\,\Gamma((n-1)/2)/\Gamma(n/2) \)。<sup>[17](https://statbook.gatech.edu/statb4.pdf)</sup>

## 软件中的实践

软件包的默认设置各不相同，这是跨工具比较结果时常见的困惑来源：<sup>[1](https://numpy.org/doc/stable/reference/generated/numpy.var.html)</sup>

- **NumPy**：`numpy.var` 默认 \( ddof = 0 \)，即总体式除数 \( N \)；要得到贝塞尔校正的样本方差需要 \( ddof = 1 \)。NumPy 2.0 新增的 `correction` 参数是与数组 API 兼容的 `ddof` 别名。<sup>[1](https://numpy.org/doc/stable/reference/generated/numpy.var.html)</sup>
- **R**：基础 `var()` 除以 \( n-1 \)；转换为总体形式需要乘以 \( (n-1)/n \)。只有一个观测值时，\( n-1 = 0 \)，结果未定义（`NA`）。<sup>[5](https://r-statistics.co/base-var-in-R.html)</sup>
- **MATLAB**：`var(A)` 默认按 \( N-1 \) 归一化；权重为 1 时选择 \( N \) 归一化。<sup>[6](https://www.mathworks.com/help/matlab/ref/double.var.html)</sup>
- **SAS**：PROC UNIVARIATE 将方差计算为校正平方和 \( \sum_{i=1}^{n}(x_i - \bar{x})^{2} \) 除以一个可配置的除数。<sup>[18](https://support.sas.com/documentation/cdl/en/procstat/67528/HTML/default/procstat_univariate_syntax01.htm)</sup>

这种校正不限于普通方差。当需要从有限时间信号中估计并去除均值时，所得自协方差和互协方差估计会以同样方式有偏；类似的校正可以消除这种偏差，而对于独立、等权重的样本，这种校正就化为贝塞尔校正。<sup>[19](https://arxiv.org/abs/2303.11047)</sup>

## References

1. [numpy.var, NumPy v2.5 Manual](https://numpy.org/doc/stable/reference/generated/numpy.var.html)
2. [Bessel's Correction, ProofWiki](https://proofwiki.org/wiki/Bessel%27s_Correction)
3. [Bessel's Correction, Wolfram MathWorld](https://mathworld.wolfram.com/BesselsCorrection.html)
4. [Bessel's Correction, Emory University Math 117](https://math.oxford.emory.edu/site/math117/besselCorrection/)
5. [var() in R: Sample Variance With NA and Covariance Handling, r-statistics.co](https://r-statistics.co/base-var-in-R.html)
6. [var, MATLAB Documentation](https://www.mathworks.com/help/matlab/ref/double.var.html)
7. [Bessel's correction, Glossary Term, Convertitive](https://convertitive.com/glossary/bessel-correction/)
8. [Revisiting Bessel's Correction and the Bias-Variance Tradeoff in Variance Estimation, The American Statistician](https://www.tandfonline.com/doi/full/10.1080/00031305.2026.2635650)
9. [Chapter 7: Unbiasedness of the Sample Variance, UC San Diego (Graham Elliott)](https://econweb.ucsd.edu/~gelliott/Chapter7SUnbiased.html)
10. [Maximum Likelihood Estimation for Gaussian Data, Introduction to Deep Learning](https://pages.cogsci.uos.de/rrawiel/introdeeplearning/practice/practice01-regression-classification/05-maximum-likelihood.html)
11. [Exploratory Data Analysis, NIST/SEMATECH e-Handbook](https://www.itl.nist.gov/div898/handbook/toolaids/pff/E-Handbook.pdf)
12. [Expectation and variance, Minjae Cho](https://sgtcho.com/en/wiki/expectation-and-variance/)
13. [Chapter 6, UC Berkeley (McFadden), E240A](https://eml.berkeley.edu/~mcfadden/e240a_sp01/ch6.pdf)
14. [1.3.5.8. Chi-Square Test for the Variance, NIST/SEMATECH e-Handbook](https://www.itl.nist.gov/div898/handbook/eda/section3/eda358.htm)
15. [Stat 3701 Lecture Notes: Statistical Models, Part II, University of Minnesota](https://www.stat.umn.edu/geyer/3701/notes/models2.html)
16. [Comment on "Revisiting Bessel's Correction and the Bias-Variance Tradeoff in Variance Estimation", The American Statistician](https://www.tandfonline.com/doi/full/10.1080/00031305.2026.2688548)
17. [7.4 Estimation of a Mean, Variance, and Proportion, Georgia Tech](https://statbook.gatech.edu/statb4.pdf)
18. [PROC UNIVARIATE Statement, SAS 9.4 Procedures Guide](https://support.sas.com/documentation/cdl/en/procstat/67528/HTML/default/procstat_univariate_syntax01.htm)
19. [Practical Realization of Bessel's Correction for a Bias-Free Estimation of the Auto-Covariance and the Cross-Covariance Functions, arXiv:2303.11047](https://arxiv.org/abs/2303.11047)

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

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Statistical inference, estimation, sampling, and testing › Estimation theory and estimator families › Estimation: overview

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/bessels-correction

English original: https://www.edgepedia.org/bessels-correction
