# UPGMA

UPGMA（非加权配对组算术平均法，unweighted pair group method with arithmetic mean）是一种凝聚式平均连接聚类算法，它根据成对距离矩阵构建一棵带枝长的有根树。每一步它合并平均距离最小的两个簇，因此结果是一棵超度量树状图，其中每片叶到根的距离都相同。它被称为大概是目前使用最广泛的层次聚类算法，应用于系统发育学、分类学、生态学、宏基因组学、数据挖掘和模式识别。<sup>[1](https://ueaeprints.uea.ac.uk/id/eprint/66076/4/Accepted_manuscript.pdf)</sup> 由于它返回的树是超度量的，它隐含地假设了一个分子钟。<sup>[2](https://cs.rice.edu/~ogilvie/comp571/upgma-and-wpgma/)</sup>

| 关键事实 | 说明 |
|---|---|
| 输出 | 一棵带枝长的有根超度量树；不允许重新定根。<sup>[3](https://www.sequentix.de/gelquest/help/upgma_method.htm)</sup> |
| 平均规则 | 簇间距离是所有交叉配对上的按大小加权均值。<sup>[4](https://isu-molphyl.github.io/EEOB563-Spring2025/lecture_notes/04_Distance_methods.pdf)</sup> |
| 枝长 | 新节点的高度为 \( D_{ij}/2 \)；到子节点 \( i \) 的边长为 \( D_{ij}/2 - h_{i} \)，到子节点 \( j \) 的边长为 \( D_{ij}/2 - h_{j} \)，其中 \( h_{i}, h_{j} \) 是它们已有的高度，因此这些边长不必相等。<sup>[5](https://www.cs.helsinki.fi/u/lmsalmel/algbio12/AfB_lecture6_04102012.pdf)</sup> |
| 精确性保证 | 在超度量距离矩阵上，UPGMA 在二次时间内重建正确的有根树。<sup>[6](https://www.cs.cmu.edu/~durand/03-711/2011/Lectures/Trees11-4.pdf)</sup> |
| 复杂度 | 朴素实现需要 \( O(n^{3}) \) 时间；最优实现需要 \( O(n^{2}) \)。<sup>[7](https://pmc.ncbi.nlm.nih.gov/articles/PMC5637958/)</sup> |
| 精度限制 | 在线性踏脚石种群结构上，UPGMA 树对真实距离矩阵的拟合 \( R^{2} \) 约为 0.45 至 0.60，而邻接法超过 0.96。<sup>[8](https://www.nature.com/articles/hdy2008136)</sup> |
| 分子钟假设 | 超度量输出意味着各谱系进化速率恒定；若分子钟不成立，则不应使用该方法。<sup>[2](https://cs.rice.edu/~ogilvie/comp571/upgma-and-wpgma/)</sup> |

## 工作原理

UPGMA 把每个项目视为一个单元素簇，并反复合并相异度最小的一对簇，其中相异度是所有交叉配对上的平均值，\( d(C_{i}, C_{j}) = \frac{1}{|C_{i}||C_{j}|} \sum_{p \in C_{i},\, q \in C_{j}} d_{pq} \)。<sup>[5](https://www.cs.helsinki.fi/u/lmsalmel/algbio12/AfB_lecture6_04102012.pdf)</sup> 对所有交叉配对取平均，而不是只取一对代表，使该方法比依赖部分元素的单连接方案更稳定。<sup>[1](https://ueaeprints.uea.ac.uk/id/eprint/66076/4/Accepted_manuscript.pdf)</sup>

当簇 \( i \) 和 \( j \) 合并时，新节点被置于高度 \( D_{ij}/2 \)，到子节点 \( i \) 的边长为 \( D_{ij}/2 - h_{i} \)，到子节点 \( j \) 的边长为 \( D_{ij}/2 - h_{j} \)，其中 \( h_{i} \) 和 \( h_{j} \) 是它们已有的高度；正是这种节点高度的赋值方式，迫使超度量树具有相等的根到叶距离。<sup>[4](https://isu-molphyl.github.io/EEOB563-Spring2025/lecture_notes/04_Distance_methods.pdf)</sup> 新簇到任何剩余簇 \( k \) 的距离更新为

\[ D_{(ij),k} = \frac{n_{i}}{n_{i} + n_{j}} D_{ik} + \frac{n_{j}}{n_{i} + n_{j}} D_{jk}, \]

即两个分量距离的按大小加权平均。<sup>[4](https://isu-molphyl.github.io/EEOB563-Spring2025/lecture_notes/04_Distance_methods.pdf)</sup> 一个距离矩阵恰好对应一棵超度量树，当且仅当三点条件 \( d_{ij} \le \max(d_{ik}, d_{kj}) \) 对每个项目三元组成立；当条件成立时，UPGMA 恢复正确的有根树，且任意两片叶的最近共同祖先的高度等于它们距离的一半。<sup>[5](https://www.cs.helsinki.fi/u/lmsalmel/algbio12/AfB_lecture6_04102012.pdf)</sup><sup> • </sup><sup>[6](https://www.cs.cmu.edu/~durand/03-711/2011/Lectures/Trees11-4.pdf)</sup> 该方法还假设可加性，即真实距离等于叶之间路径上枝长之和；若最小二乘解为零且数据是类钟的，则 UPGMA 保证返回最优树。<sup>[9](https://www.cs.tau.ac.il/~rshamir/algmb/00/scribe00/html/lec08/node21.html)</sup>

## 操作步骤

典型工作流程从比对开始：统计差异位点以获得 P 距离，然后在聚类前应用替换模型校正，例如 Jukes-Cantor 距离 \( d = -\frac{3}{4} \ln(1 - \frac{4}{3}p) \)。<sup>[2](https://cs.rice.edu/~ogilvie/comp571/upgma-and-wpgma/)</sup> 使用者随后合并最近的一对，将节点高度设为合并距离的一半，用加权平均规则更新矩阵的行和列，并重复直至只剩一个簇；在一个示例中，根的高度为 \( 1.22 \times 0.5 = 0.61 \) 每位点替换数。<sup>[2](https://cs.rice.edu/~ogilvie/comp571/upgma-and-wpgma/)</sup><sup> • </sup><sup>[4](https://isu-molphyl.github.io/EEOB563-Spring2025/lecture_notes/04_Distance_methods.pdf)</sup>

朴素实现花费 \( O(n^{3}) \) 时间，主要用于寻找最小值和更新矩阵；Gronau 和 Moran 综述了最优的 \( O(n^{2}) \) 时间实现，这些实现合并“局部最近”的一对，并说明了这种放宽的方案何时等价于原始的全局最近方案。<sup>[7](https://pmc.ncbi.nlm.nih.gov/articles/PMC5637958/)</sup><sup> • </sup><sup>[10](https://doi.org/10.1016/j.ipl.2007.07.002)</sup> 对于非常大的输入，MGUPGMA 在多个 GPU 上并行化该算法，相比 CPU 和单 GPU 实现达到约 3 倍至 7 倍的加速。<sup>[7](https://pmc.ncbi.nlm.nih.gov/articles/PMC5637958/)</sup> 在 R 中，phangorn 将 UPGMA 实现为 stats::hclust 的包装器，方法为“average”（WPGMA 使用“mcquitty”），并将结果转换为 phylo 对象；当前版本不应用最近邻交换重排。<sup>[11](https://github.com/KlausVigo/phangorn/blob/main/R/upgma.R)</sup> 一种实用的拟合诊断是树与输入距离之间的共表型相关：高于 0.9 为极好，0.8 至 0.9 为好，0.6 至 0.8 为中等，低于 0.6 为差，建议改用邻接法。<sup>[12](https://metricgate.com/docs/phylogenetic-tree-upgma/)</sup>

## 起源

它建立在同一批作者早先的数量分类工作之上，即查尔斯·D·米切纳（Charles D. Michener）和罗伯特·R·索卡尔（Robert R. Sokal）于 1957 年发表在《进化》（Evolution）上的《分类问题的一种定量方法》（A quantitative approach to a problem in classification）。<sup>[13](https://doi.org/10.1111/j.1558-5646.1957.tb02884.x)</sup><sup> • </sup><sup>[14](https://onlinelibrary.wiley.com/doi/10.2307/1217562)</sup><sup> • </sup><sup>[15](https://doi.org/10.1007/s10739-024-09782-8)</sup>

## 变体

**WPGMA** 仅在矩阵更新上不同：新距离是简单平均，不按分类单元数加权。其命名以令人困惑著称，因为非加权 PGMA 使用加权平均，而加权 PGMA 使用非加权平均。<sup>[2](https://cs.rice.edu/~ogilvie/comp571/upgma-and-wpgma/)</sup> 这一差异在数值上有影响：在一个四分类单元示例中，将 {A,B} 与 {C} 合并，在 UPGMA 下得到 \( (2 \cdot 1.5 + 1 \cdot 3)/(2+1) = 2 \)，而在 WPGMA 下得到 \( (1.5+3)/2 = 2.25 \)。<sup>[16](https://bioinformatics.bc.edu/clotelab/BIOL4200/Notes/Notes/LECTURES/UPGMA/upgma.html)</sup> 其他连接规则完全取代平均值：完全连接取最大交叉距离，单连接取最小交叉距离。<sup>[3](https://www.sequentix.de/gelquest/help/upgma_method.htm)</sup>

对于非类钟数据的系统发育，最接近的替代方法是邻接法，由斋藤（Saitou）和根井（Nei）于 1987 年在《分子生物学与进化》（Molecular Biology and Evolution）上报道，它处理可加但非超度量的矩阵，并返回无根树。<sup>[17](https://doi.org/10.1093/oxfordjournals.molbev.a040454)</sup><sup> • </sup><sup>[5](https://www.cs.helsinki.fi/u/lmsalmel/algbio12/AfB_lecture6_04102012.pdf)</sup> Fitch-Margoliash 最小二乘法最小化观测距离与预测树距离之差的平方和，<sup>[4](https://isu-molphyl.github.io/EEOB563-Spring2025/lecture_notes/04_Distance_methods.pdf)</sup> 最小进化准则由 Rzhetsky 和根井于 1993 年在《分子生物学与进化》上奠定理论基础。<sup>[18](https://doi.org/10.1093/oxfordjournals.molbev.a040056)</sup> Li 1981 年发表在 PNAS 上的方法类似于 UPGMA，但校正了谱系间不平等的进化速率，在 Tateno 的模拟比较中表现明显优于 UPGMA 和 Fitch-Margoliash，并在美洲原住民基因频率数据上给出了更合理的拓扑结构。<sup>[19](https://www.pnas.org/doi/10.1073/pnas.78.2.1085)</sup> 对于不同时点采样（末端定年）的数据，phangorn 提供 supgma，它在速率校正距离上迭代 UPGMA 并进行 NNI 重排。<sup>[11](https://github.com/KlausVigo/phangorn/blob/main/R/upgma.R)</sup>

## 应用

在系统发育学之外，UPGMA 仍是标准的初筛工具。DendroUPGMA 网络服务器从变量集、相似性矩阵或距离矩阵构建 UPGMA 或 WPGMA 树状图；其文档记载的用途包括从密码子使用检测水平转移基因（该服务器的最初目的）、根据 RFLP 和二元标记对微生物菌株分类，以及按化学指纹相似性对小分子聚类。<sup>[20](https://usuaris.tinet.cat/debb/UPGMA/DendroUPGMA_Tut.pdf)</sup> 当前的浏览器和 R 计算器使用 ape::dist.dna 计算距离，并用 phangorn::upgma 拟合树，确认了它在现代流程中的地位。<sup>[12](https://metricgate.com/docs/phylogenetic-tree-upgma/)</sup>

## 局限与替代方法

主要的失效模式是速率变异。UPGMA 假设所有谱系的突变率恒定，当这一假设不成立时，它经常产生错误的拓扑结构。<sup>[3](https://www.sequentix.de/gelquest/help/upgma_method.htm)</sup> 在可加但非超度量的矩阵上，它返回错误的拓扑结构，而邻接法能在二次时间内正确恢复。<sup>[6](https://www.cs.cmu.edu/~durand/03-711/2011/Lectures/Trees11-4.pdf)</sup> 由于输出被强制为超度量，当三点性质被违反时，树距离不必与输入矩阵匹配；在一个例子中，C 和 D 之间的树距离为 2，而矩阵距离为 3。<sup>[16](https://bioinformatics.bc.edu/clotelab/BIOL4200/Notes/Notes/LECTURES/UPGMA/upgma.html)</sup> 即使没有模型错误设定，UPGMA 也可能不一致，而邻接法和最小二乘法则不同，它们的一致性已被证明。<sup>[21](https://academic.oup.com/mbe/article-pdf/21/9/1629/6306017/msh159.pdf)</sup> 作为一个优化问题，UPGMA 是归一化等距最小进化问题的贪心启发式，该问题即使对满足三角不等式的矩阵也是 NP 难的，且 UPGMA 树的得分可能比最优值差 \( \Omega(n) \) 倍。<sup>[1](https://ueaeprints.uea.ac.uk/id/eprint/66076/4/Accepted_manuscript.pdf)</sup>

基准测试结果量化了这些限制。在模拟的踏脚石种群上，由真实遗传距离构建的 UPGMA 树的 \( R^{2} \) 为 0.45 至 0.60，并严重扭曲了参数结构，而邻接法超过 0.96；树构建引入的误差通常是距离估计误差的两倍。在层级破碎化下，UPGMA 消除了距离矩阵约 50% 的平方误差。<sup>[8](https://www.nature.com/articles/hdy2008136)</sup> 在八条 DNA 序列的模拟中，当每条序列的替换数较小或中等偏大时，以及当替换速率随谱系变化时，Fitch-Margoliash、距离 Wagner 和改进 Farris 方法比 UPGMA 更好地恢复正确拓扑，但替换数很多的数据构建的有根树除外；当替换数很大时，UPGMA 至少同样好，尤其对有根树。<sup>[22](https://pubmed.ncbi.nlm.nih.gov/3447006/)</sup> 早期的模拟发现，当期望遗传距离与进化时间成正比时，UPGMA 比若干替代方法更有效。<sup>[23](http://www.saitou-naruya-laboratory.org/assets/files/pdf/Nei_MBE85.pdf)</sup> 在 100 个 Pfam 蛋白家族的基准测试中，BIONJ 产生了最佳总体结果，而在子集上评估的 UPGMA 相比之下较差；同一研究指出 UPGMA“在系统发育树构建中通常不被信任”。<sup>[24](https://academic.oup.com/mbe/article/22/11/2257/1257163)</sup> 实用规则源于其保证：当需要类钟的超度量树，或作为快速的探索性树状图时，使用 UPGMA；当速率可能变化时，优先使用邻接法或最小二乘法。<sup>[6](https://www.cs.cmu.edu/~durand/03-711/2011/Lectures/Trees11-4.pdf)</sup><sup> • </sup><sup>[9](https://www.cs.tau.ac.il/~rshamir/algmb/00/scribe00/html/lec08/node21.html)</sup>

## References

1. [UPGMA and the normalized equidistant minimum evolution problem](https://ueaeprints.uea.ac.uk/id/eprint/66076/4/Accepted_manuscript.pdf)
2. [UPGMA and WPGMA trees (Ogilvie, Rice COMP571 course notes)](https://cs.rice.edu/~ogilvie/comp571/upgma-and-wpgma/)
3. [UPGMA Method (GelQuest documentation)](https://www.sequentix.de/gelquest/help/upgma_method.htm)
4. [4. Distance Methods (EEOB563, Spring 2025)](https://isu-molphyl.github.io/EEOB563-Spring2025/lecture_notes/04_Distance_methods.pdf)
5. [Distance-based clustering, UPGMA (lecture notes, University of Helsinki)](https://www.cs.helsinki.fi/u/lmsalmel/algbio12/AfB_lecture6_04102012.pdf)
6. [Trees: distance-based methods (CMU lecture notes)](https://www.cs.cmu.edu/~durand/03-711/2011/Lectures/Trees11-4.pdf)
7. [MGUPGMA: A Fast UPGMA Algorithm With Multiple Graphics Processing Units Using NCCL](https://pmc.ncbi.nlm.nih.gov/articles/PMC5637958/)
8. [How well do evolutionary trees describe genetic relationships among populations? (Heredity)](https://www.nature.com/articles/hdy2008136)
9. [UPGMA (Algorithms in Molecular Biology, Tel Aviv University)](https://www.cs.tau.ac.il/~rshamir/algmb/00/scribe00/html/lec08/node21.html)
10. [Ilan Gronau, Shlomo Moran (2007). Optimal implementations of UPGMA and other common clustering algorithms. Information Processing Letters.](https://doi.org/10.1016/j.ipl.2007.07.002)
11. [R/upgma.R, phangorn package source (UPGMA, WPGMA and sUPGMA)](https://github.com/KlausVigo/phangorn/blob/main/R/upgma.R)
12. [Phylogenetic Tree (UPGMA) Explained: Calculator | MetricGate](https://metricgate.com/docs/phylogenetic-tree-upgma/)
13. [Charles D. Michener, Robert R. Sokal (1957). A QUANTITATIVE APPROACH TO A PROBLEM IN CLASSIFICATION. Evolution.](https://doi.org/10.1111/j.1558-5646.1957.tb02884.x)
14. [THE PRINCIPLES AND PRACTICE OF NUMERICAL TAXONOMY (Sokal, TAXON 1963)](https://onlinelibrary.wiley.com/doi/10.2307/1217562)
15. [How Phenograms and Cladograms Became Molecular Phylogenetic Trees](https://doi.org/10.1007/s10739-024-09782-8)
16. [Stepping through the UPGMA algorithm (BIOL4200, Boston College)](https://bioinformatics.bc.edu/clotelab/BIOL4200/Notes/Notes/LECTURES/UPGMA/upgma.html)
17. [N Saitou, M Nei (1987). The neighbor-joining method: a new method for reconstructing phylogenetic trees.. Molecular Biology and Evolution.](https://doi.org/10.1093/oxfordjournals.molbev.a040454)
18. [A Rzhetsky, M Nei (1993). Theoretical foundation of the minimum-evolution method of phylogenetic inference.. Molecular Biology and Evolution.](https://doi.org/10.1093/oxfordjournals.molbev.a040056)
19. [Simple method for constructing phylogenetic trees from distance matrices (Li, 1981)](https://www.pnas.org/doi/10.1073/pnas.78.2.1085)
20. [UPGMA tutorial (DendroUPGMA server documentation)](https://usuaris.tinet.cat/debb/UPGMA/DendroUPGMA_Tut.pdf)
21. [On Inconsistency of the Neighbor-Joining, Least Squares, and Minimum Evolution Estimation When Substitution Processes Are Incorrectly Modeled](https://academic.oup.com/mbe/article-pdf/21/9/1629/6306017/msh159.pdf)
22. [Accuracy of phylogenetic trees estimated from DNA sequence data](https://pubmed.ncbi.nlm.nih.gov/3447006/)
23. [Methods for Computing the Standard Errors of Branching Points in an Evolutionary Tree... (Nei, Stephens & Saito, MBE 1985)](http://www.saitou-naruya-laboratory.org/assets/files/pdf/Nei_MBE85.pdf)
24. [Assessment of Protein Distance Measures and Tree-Building Methods for Phylogenetic Tree Reconstruction](https://academic.oup.com/mbe/article/22/11/2257/1257163)

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

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Multivariate association and dimension reduction › Titles Mo to W

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/upgma

English original: https://www.edgepedia.org/upgma
