# 四分位距

**四分位距**（interquartile range，IQR）是一种统计离散度的度量，等于变量的第75百分位数（第三四分位数，Q3）与第25百分位数（第一四分位数，Q1）之差，因此它横跨数据中间50%的部分<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/iqrange.htm)</sup><sup> • </sup><sup>[2](https://www.nist.gov/system/files/documents/2018/08/13/nistir-5951-c.pdf)</sup>。它被用作一种稳健的尺度度量，是标准差的替代方案，受极端值的影响较小<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/iqrange.htm)</sup>。

| 关键事实 | 说明 |
|---|---|
| 定义 | IQR = Q3 − Q1，即第75百分位数与第25百分位数之差<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/iqrange.htm)</sup> |
| 覆盖度 | 涵盖数据中间50%的部分，估计数据的散布或离散程度<sup>[2](https://www.nist.gov/system/files/documents/2018/08/13/nistir-5951-c.pdf)</sup> |
| 稳健性 | 受极端值的影响小于标准差；崩溃点为25%，低于MAD的50%<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/iqrange.htm)</sup><sup> • </sup><sup>[3](https://doi.org/10.1002/WIDM.1236)</sup> |
| 与正态分布的关系 | 对正态数据，IQR约为标准差的1.349倍；归一化IQR为0.7413 × IQR<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/iqrange.htm)</sup> |
| 离群值规则 | 超出 Q1 − 1.5·IQR 或 Q3 + 1.5·IQR 的点为轻度离群值；超出 3·IQR 栅栏的为极端离群值<sup>[4](https://itl.nist.gov/div898/handbook/prc/section1/prc16.htm)</sup> |
| 图形中的作用 | 它是箱线图所使用的尺度度量，箱体绘制在两个四分位数之间<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/iqrange.htm)</sup><sup> • </sup><sup>[5](https://www.itl.nist.gov/div898/handbook/eda/section3/boxplot.htm)</sup> |

## 定义与计算

若下四分位数为 Q1、上四分位数为 Q3，则四分位距为二者之差，IQR = Q3 − Q1<sup>[4](https://itl.nist.gov/div898/handbook/prc/section1/prc16.htm)</sup>。四分位数可用标准的电子表格函数计算，例如 Excel 的 =QUARTILE(value 1..value n, 1) 与 =QUARTILE(value 1..value n, 3)，也可以通过排序数据、将其分成四段来近似<sup>[2](https://www.nist.gov/system/files/documents/2018/08/13/nistir-5951-c.pdf)</sup>。在 NISTIR 5951 的算例中，20 个已排序的数值被分成四段、每段五个；舍去最高和最低的五个，剩下的便是中间 50%，算得 Q1 为 −9.5%、Q3 为 −1.5%，IQR 为 8%<sup>[2](https://www.nist.gov/system/files/documents/2018/08/13/nistir-5951-c.pdf)</sup>。

样本四分位数的计算没有唯一通用的方法。1996 年，莫纳什大学（Monash University）计量经济学教授罗布·J·海因德曼（Rob J. Hyndman）与范亚楠（Yanan Fan）比较了各统计软件包中实现的样本分位数定义，发现使用中的定义数量众多，有时同一软件包内针对不同用途也各用一套；他们建议采用一种标准定义，即中位数无偏估计量<sup>[6](https://research.monash.edu/en/publications/sample-quantiles-in-statistical-packages/)</sup>。例如，R 的 IQR 函数是用 quantile 函数（默认 type 7）计算四分位数的，并不遵循图基的建议，其计算式为 IQR(x) = quantile(x, 3/4) − quantile(x, 1/4)<sup>[7](https://search.r-project.org/R/refmans/stats/html/IQR.html)</sup>。NumPy 的 percentile 函数同样提供九种估计方法，按其 R 类型排序，默认使用 'linear'（type 7）<sup>[8](https://numpy.org/doc/stable/reference/generated/numpy.percentile.html?highlight=numpy+quantile)</sup>。

## 稳健性

四分位距之所以在实践中占有一席之地，靠的是它对离群值的抵抗力。单个离群值就能让标准差变得任意大，因此其崩溃点为 0%；而四分位距的崩溃点为 25%，意味着在估计失效之前，最多可以有四分之一的数据被污染；中位数绝对偏差（MAD）与 Qn 估计量则可达 50%<sup>[3](https://doi.org/10.1002/WIDM.1236)</sup>。美国国家标准与技术研究院关于 Qn 的文档把 MAD 与四分位距并称为最常用的两种标准差稳健替代方案<sup>[9](https://itl.nist.gov/div898/software/dataplot/refman2/auxillar/qn_scale.htm)</sup>。

美国国家标准与技术研究院的《工程统计手册》（*Engineering Statistics Handbook*）区分了两种稳健性。四分位距与 MAD 具有有效性稳健性，意思是即使潜在分布并非正态，基于它们构建的置信区间也大致能保持其标称覆盖度；但它们在效率稳健性上并不特别强，也就是说，与已知真实分布时所能达到的精度相比，它们会损失精度。当直方图或概率图显示数据接近正态时，标准差仍是明智之选；若分布长尾，则 MAD、平均绝对偏差或 IQR 之类的替代方案更为合理<sup>[10](https://www.itl.nist.gov/div898/handbook/eda/section3/eda356.htm)</sup>。

## 与标准差的关系

对正态分布而言，四分位距约为标准差的 1.349 倍，因此把 IQR 乘以 0.7413 得到的归一化 IQR，可用来估计正态数据的标准差<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/iqrange.htm)</sup>。R 的文档描述了同样的关系：若 X 服从分布 N(m,1)，则 E[IQR(X)] 等于 2·qnorm(3/4)，即 1.3490；因此在正态性下把 IQR(x) 除以 1.349，便得到标准差的一致估计量<sup>[7](https://search.r-project.org/R/refmans/stats/html/IQR.html)</sup>。

这一换算用于质量控制。NISTIR 5951 因四分位距对离群值相对不敏感而推荐用它代替标准差，并据此计算控制限：对某一浓度类别，IQR 为 8%，乘以 0.741 得标准差 5.93%，再翻倍得到 2×SD 控制限 ±11.9%。而对同一批含有一个离群值的数据直接计算标准差，得到的控制限更宽，为 ±19.1%<sup>[2](https://www.nist.gov/system/files/documents/2018/08/13/nistir-5951-c.pdf)</sup>。

## 在箱线图与离群值检测中的应用

箱线图由贝尔实验室（Bell Laboratories）与普林斯顿大学（Princeton University）的统计学家约翰·W·图基（John W. Tukey）在其 1977 年的著作《探索性数据分析》（*Exploratory Data Analysis*）中推广开来，它正是以 IQR 为基础构建的<sup>[7](https://search.r-project.org/R/refmans/stats/html/IQR.html)</sup><sup> • </sup><sup>[11](https://dblp.org/rec/books/lib/Tukey77)</sup>。箱体绘制在下四分位数与上四分位数之间，中位数处画一条线，因此箱体长度即为 IQR，代表数据的中间 50%<sup>[5](https://www.itl.nist.gov/div898/handbook/eda/section3/boxplot.htm)</sup>。

由 IQR 构建的栅栏可标记出不寻常的观测。内栅栏位于 Q1 − 1.5·IQR 与 Q3 + 1.5·IQR，外栅栏位于 Q1 − 3·IQR 与 Q3 + 3·IQR；超出内栅栏的点为轻度离群值，超出外栅栏的点为极端离群值<sup>[4](https://itl.nist.gov/div898/handbook/prc/section1/prc16.htm)</sup>。在美国国家标准与技术研究院的一个算例中，N = 90 个已排序观测的四分位数为 429.75 与 742.25，IQR 为 312.5，上内栅栏为 1211.0<sup>[4](https://itl.nist.gov/div898/handbook/prc/section1/prc16.htm)</sup>。鲁索（Rousseeuw）指出了这一规则的局限：由于加在 Q3 上的量与从 Q1 减去的量相同，箱线图假定了对称性，而在非对称分布下，它可能把许多正常的数据点标记为离群值<sup>[3](https://doi.org/10.1002/WIDM.1236)</sup>。

## 相关度量与用途

四分位距属于一族稳健的尺度估计量。MAD 即各观测与中位数之绝对偏差的中位数，更为稳健（崩溃点 50%），但假定对称，且对正态数据的效率较低（37%）；鲁索与克鲁克斯（Croux）的 Qn 估计量保持了 50% 的崩溃点，同时达到 82% 的正态效率，且不依赖对称性<sup>[3](https://doi.org/10.1002/WIDM.1236)</sup><sup> • </sup><sup>[9](https://itl.nist.gov/div898/software/dataplot/refman2/auxillar/qn_scale.htm)</sup>。把 IQR 除以中位数，可得到变异系数的稳健类比，用于衡量相对离散程度<sup>[12](https://arxiv.org/abs/1907.01110)</sup>。

由于试验往往报告的是中位数与四分位数，而非均值与标准差，已有方法可从样本量、中位数、极差与 IQR 估计样本均值与标准差，这在元分析中合并结果时是必需的<sup>[13](https://arxiv.org/abs/1407.8038)</sup>。此外还发展了基于分位数的置换方法，用于以总体 IQR 本身为估计目标的因子设计假设检验<sup>[14](https://arxiv.org/abs/1912.09146)</sup>。

## References

1. [Interquartile Range, Dataplot Reference Manual, NIST](https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/iqrange.htm)
2. [NISTIR 5951, National Institute of Standards and Technology](https://www.nist.gov/system/files/documents/2018/08/13/nistir-5951-c.pdf)
3. [P. J. Rousseeuw (2018). Anomaly detection by robust statistics. WIREs Data Mining and Knowledge Discovery.](https://doi.org/10.1002/WIDM.1236)
4. [7.1.6. What are outliers in the data?, NIST Engineering Statistics Handbook](https://itl.nist.gov/div898/handbook/prc/section1/prc16.htm)
5. [1.3.3.7. Box Plot, NIST Engineering Statistics Handbook](https://www.itl.nist.gov/div898/handbook/eda/section3/boxplot.htm)
6. [R. J. Hyndman and Y. Fan (1996). Sample Quantiles in Statistical Packages. The American Statistician 50(4), 361–365.](https://research.monash.edu/en/publications/sample-quantiles-in-statistical-packages/)
7. [IQR {stats}, R Documentation](https://search.r-project.org/R/refmans/stats/html/IQR.html)
8. [numpy.percentile, NumPy v2.5 Manual](https://numpy.org/doc/stable/reference/generated/numpy.percentile.html?highlight=numpy+quantile)
9. [QN SCALE, Dataplot Reference Manual, NIST](https://itl.nist.gov/div898/software/dataplot/refman2/auxillar/qn_scale.htm)
10. [1.3.5.6. Measures of Scale, NIST Engineering Statistics Handbook](https://www.itl.nist.gov/div898/handbook/eda/section3/eda356.htm)
11. [J. W. Tukey (1977). Exploratory Data Analysis. Addison-Wesley.](https://dblp.org/rec/books/lib/Tukey77)
12. [Robust analogs to the Coefficient of Variation, arXiv](https://arxiv.org/abs/1907.01110)
13. [Estimating the sample mean and standard deviation from the sample size, median, range and/or interquartile range, arXiv](https://arxiv.org/abs/1407.8038)
14. [QANOVA: Quantile-based Permutation Methods For General Factorial Designs, arXiv](https://arxiv.org/abs/1912.09146)

---
*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 › Estimation theory and estimator families › Robust statistics and resampling › Robust location and scale estimators

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/interquartile-range

English original: https://www.edgepedia.org/interquartile-range
