# 逆伽马分布

**逆伽马分布**是正实数上的一种连续概率分布，由伽马分布随机变量的倒数得到：若 \( X \sim \mathrm{Gamma}(a, b) \) 且 \( Z = 1/X \)，则 \( Z \) 服从逆伽马分布，记作 \( Z \sim \mathrm{Inv\text{-}Ga}(a, b) \)<sup>[1](https://www-users.york.ac.uk/~bp787/Bayes_notes.html)</sup>。它的主要作用在贝叶斯统计中，作为均值已知的正态分布方差的共轭先验<sup>[2](https://quarto.wessa.net/invgamma.html)</sup><sup> • </sup><sup>[3](https://people.eecs.berkeley.edu/~jordan/courses/260-spring10/lectures/lecture5.pdf)</sup>。它也被称为倒伽马分布，并与皮尔逊V型分布重合<sup>[4](https://reference.wolfram.com/language/ref/InverseGammaDistribution.html)</sup><sup> • </sup><sup>[5](https://search.r-project.org/CRAN/refmans/PearsonDS/html/PearsonV.html)</sup>。

| 关键事实 | 详情 |
|---|---|
| 定义 | 伽马随机变量的倒数：\( X \sim \mathrm{Gamma}(\alpha, \beta) \) 蕴含 \( 1/X \sim \mathrm{InvGamma}(\alpha, \beta) \)<sup>[2](https://quarto.wessa.net/invgamma.html)</sup> |
| 密度 | 对 \( x > 0 \)，\( f(x) = \frac{\beta^{\alpha}}{\Gamma(\alpha)}\, x^{-\alpha-1} e^{-\beta/x} \)，其中形状参数 \( \alpha > 0 \)，尺度参数 \( \beta > 0 \)<sup>[6](https://mc-stan.org/docs/2_28/functions-reference/inverse-gamma-distribution.html)</sup> |
| 矩 | 当 \( \alpha > 1 \) 时均值为 \( \beta/(\alpha-1) \)；当 \( \alpha > 2 \) 时方差为 \( \beta^2/((\alpha-1)^2(\alpha-2)) \)；众数为 \( \beta/(\alpha+1) \)<sup>[2](https://quarto.wessa.net/invgamma.html)</sup> |
| 共轭性 | 均值已知的正态似然方差的共轭先验；后验为 \( \mathrm{InvGamma}(\alpha + n/2,\ \beta + \mathrm{SSR}/2) \)<sup>[2](https://quarto.wessa.net/invgamma.html)</sup> |
| 重参数化 | 自由度为 \( \nu \)、尺度为 \( \tau^2 \) 的缩放逆卡方分布等于 \( \mathrm{InvGamma}(\nu/2,\ \nu\tau^2/2) \)<sup>[7](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.invgamma.html)</sup> |
| 抽样 | 逆伽马变量通过取伽马变量的倒数生成<sup>[2](https://quarto.wessa.net/invgamma.html)</sup> |
| 已知局限 | 用作分层方差“非信息”先验的逆伽马(ε, ε)先验，产生的后验对 ε 仍然敏感<sup>[8](https://sites.stat.columbia.edu/gelman/bayescomputation/Gelman2006.pdf)</sup> |

## 密度与矩

设形状参数为 \( \alpha \)、尺度参数为 \( \beta \)，二者均严格为正，则密度为

\[ f(x) = \frac{\beta^{\alpha}}{\Gamma(\alpha)}\, x^{-(\alpha+1)} \exp\left(-\frac{\beta}{x}\right), \qquad x > 0, \]

其中 \( \Gamma \) 为伽马函数<sup>[6](https://mc-stan.org/docs/2_28/functions-reference/inverse-gamma-distribution.html)</sup><sup> • </sup><sup>[2](https://quarto.wessa.net/invgamma.html)</sup>。累积分布函数通过上不完全伽马函数表示，\( F(x) = \Gamma(\alpha, \beta/x)/\Gamma(\alpha) \)，在软件中通常按伽马分布在 \( 1/x \) 处的上尾概率来计算<sup>[2](https://quarto.wessa.net/invgamma.html)</sup>。

矩仅在形状参数超过相应阈值时存在。当 \( \alpha > 1 \) 时均值为 \( \beta/(\alpha-1) \)，当 \( \alpha \le 1 \) 时均值无定义；当 \( \alpha > 2 \) 时方差为 \( \beta^2/((\alpha-1)^2(\alpha-2)) \)；众数为 \( \beta/(\alpha+1) \)<sup>[2](https://quarto.wessa.net/invgamma.html)</sup>。当 \( n < \alpha \) 时，第 \( n \) 阶原点矩为 \( \beta^n \Gamma(\alpha-n)/\Gamma(\alpha) \)<sup>[2](https://quarto.wessa.net/invgamma.html)</sup>。该分布总是正偏的，当 \( \alpha > 3 \) 时偏度为 \( 4\sqrt{\alpha-2}/(\alpha-3) \)<sup>[2](https://quarto.wessa.net/invgamma.html)</sup>。与伽马分布不同，当 \( t > 0 \) 时矩生成函数不存在<sup>[2](https://quarto.wessa.net/invgamma.html)</sup>。

## 与其他分布的关系

**伽马分布与逆卡方分布。** 逆伽马分布由伽马分布取倒数定义，因此这种关系是双向的：若 \( X \sim \mathrm{InvGamma}(\alpha, \beta) \)，则 \( 1/X \) 服从伽马分布<sup>[2](https://quarto.wessa.net/invgamma.html)</sup>。由于自由度为 \( \nu \) 的卡方变量为 \( \mathrm{Gamma}(\nu/2, 1/2) \)，其倒数服从 \( \mathrm{InvGamma}(\nu/2, 1/2) \)，即逆卡方分布；再添加一个尺度即得到缩放逆卡方分布 \( \mathrm{InvGamma}(\nu/2, \nu\sigma_0^2/2) \)<sup>[2](https://quarto.wessa.net/invgamma.html)</sup>。SciPy 文档给出了相同的映射：自由度为 \( \nu \)、缩放参数为 \( \tau^2 \) 的缩放逆卡方分布被建模为 `invgamma`，参数为 \( a = \nu/2 \)、尺度为 \( \nu\tau^2/2 \)，而 `invgamma` 是广义伽马分布在 \( c = -1 \) 时的特例<sup>[7](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.invgamma.html)</sup>。

**皮尔逊V型。** 在皮尔逊分布族中，逆伽马分布即V型分布，这一分类可追溯至卡尔·皮尔逊（Karl Pearson）1901年的论文<sup>[5](https://search.r-project.org/CRAN/refmans/PearsonDS/html/PearsonV.html)</sup><sup> • </sup><sup>[9](https://www.scientificlib.com/en/Mathematics/LX/PearsonDistribution.html)</sup>。四参数广义逆伽马分布则额外增加一个形状参数和一个位置参数<sup>[4](https://reference.wolfram.com/language/ref/InverseGammaDistribution.html)</sup>。

## 作为共轭先验的用途

该分布的主要应用是正态方差的贝叶斯推断。若 \( X_1, \ldots, X_n \) 是均值 \( \mu \) 已知、\( \sigma^2 \sim \mathrm{InvGamma}(\alpha, \beta) \) 的独立正态观测，则后验为

\[ \sigma^2 \mid \mathbf{x} \sim \mathrm{InvGamma}\left(\alpha + \frac{n}{2},\ \beta + \frac{\mathrm{SSR}}{2}\right), \qquad \mathrm{SSR} = \sum_{i=1}^{n} (x_i - \mu)^2. \]

因此该先验是共轭的：先验与后验属于同一分布族，更新只需将 \( n/2 \) 加到形状参数上、将偏差平方和的一半加到尺度参数上<sup>[2](https://quarto.wessa.net/invgamma.html)</sup><sup> • </sup><sup>[3](https://people.eecs.berkeley.edu/~jordan/courses/260-spring10/lectures/lecture5.pdf)</sup>。当均值未知时，共轭先验是正态-逆伽马联合分布，而非仅对 \( \sigma^2 \) 取逆伽马先验<sup>[2](https://quarto.wessa.net/invgamma.html)</sup><sup> • </sup><sup>[1](https://www-users.york.ac.uk/~bp787/Bayes_notes.html)</sup>。在标准共轭参数化中，先验超参数写作 \( \nu_0/2 \) 和 \( \nu_0\sigma_0^2/2 \)，从而 \( \nu_0 \) 充当先验观测数、\( \sigma_0^2 \) 充当其均方偏差；更新时将样本量加到 \( \nu_0 \) 上，将样本平方和加到先验平方和上<sup>[1](https://www-users.york.ac.uk/~bp787/Bayes_notes.html)</sup>。对 \( (\mu, \sigma^2) \) 取正态-逆伽马先验还使均值的边际分布为学生t分布，这是t分布在分层模型中出现的一种方式<sup>[10](https://www.stat.cmu.edu/~brian/463-2012/week09/Chapter%2003.pdf)</sup>。

在正态模型之外，当寿命分布为指数分布时，倒伽马分布被用作贝叶斯可靠性抽样方案中产品平均寿命的自然共轭先验<sup>[11](https://doi.org/10.1108/IJQRM-08-2013-0138)</sup>，逆伽马先验也出现在贝叶斯回归的残差方差上<sup>[12](https://treese41528.github.io/ComputationalDataScience/Website/part3_bayesian/chapter5/ch5_2-prior-distributions.html)</sup>。

## 作为非信息先验的批评

形状和尺度取值极小的逆伽马先验，如 \( \mathrm{InvGamma}(0.001, 0.001) \)，曾被广泛用作分层模型中方差参数所谓的非信息先验。哥伦比亚大学（Columbia University）统计学与政治学教授安德鲁·格尔曼（Andrew Gelman）在2006年的一项分析中表明，这一分布族作为默认先验存在严重问题：当 ε 趋近于零时，逆伽马(ε, ε)模型不存在可归一化的极限后验分布，因此后验推断对 ε 的选取仍然敏感；当组数较少或组水平方差接近零时，结果可能严重失准<sup>[8](https://sites.stat.columbia.edu/gelman/bayescomputation/Gelman2006.pdf)</sup>。他转而建议对分层标准差使用均匀先验，或在需要弱信息先验时使用 half-t 分布族<sup>[8](https://sites.stat.columbia.edu/gelman/bayescomputation/Gelman2006.pdf)</sup>。

扎卡里·布雷姆（Zachary Brehm）、萨莉·W·瑟斯顿（Sally W. Thurston）及其同事后来的一项模拟研究，在包括八学校模型在内的三个分层模型中比较了随机效应标准差的逆伽马先验与 half-t 先验。在多数设定下，half-t 先验下标准差后验的偏差小于对应的逆伽马先验，而逆伽马先验通常给出相近的覆盖率但区间长度更短；对极小标准差的估计会引起收敛问题，对 half-t 先验尤为如此<sup>[13](https://arxiv.org/abs/2108.12045)</sup>。

## 估计与软件

当需要直接拟合逆伽马数据时，最大似然估计通过数值方法求得，矩估计法的初值为 \( \tilde{\alpha} = \bar{x}^2/s^2 + 2 \) 和 \( \tilde{\beta} = \bar{x}(\tilde{\alpha} - 1) \)<sup>[2](https://quarto.wessa.net/invgamma.html)</sup>。关于该分布本身的参数学习有专门的文献：一篇论文介绍了基于矩估计法、最大似然和完全贝叶斯估计的五种算法，其中包括首个使解析贝叶斯推断成为可能的逆伽马形状参数共轭先验<sup>[14](https://arxiv.org/abs/1605.01019)</sup>。

标准软件直接实现了该分布。SciPy 提供 `scipy.stats.invgamma`，具有通常的密度、分布、分位数和随机数生成方法<sup>[7](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.invgamma.html)</sup>；Stan 提供带形状和尺度参数的 `inv_gamma` 密度、累积分布函数和随机数函数<sup>[6](https://mc-stan.org/docs/2_28/functions-reference/inverse-gamma-distribution.html)</sup>；R 包 actuar 和 Boom 包含用于损失建模和贝叶斯计算的逆伽马函数<sup>[15](https://opensourcesoftware.casact.org/actuar)</sup><sup> • </sup><sup>[16](https://search.r-project.org/CRAN/refmans/Boom/html/invgamma.html)</sup>。随机变量最简单的生成方式是抽取一个伽马变量并取其倒数<sup>[2](https://quarto.wessa.net/invgamma.html)</sup>。

## References

1. [Bayesian Statistics: notes to accompany the lectures, University of York](https://www-users.york.ac.uk/~bp787/Bayes_notes.html)
2. [Inverse Gamma Distribution, Statistical Analysis for Small and Big Data (Wessa)](https://quarto.wessa.net/invgamma.html)
3. [The Conjugate Prior for the Normal Distribution, UC Berkeley lecture notes (M. I. Jordan)](https://people.eecs.berkeley.edu/~jordan/courses/260-spring10/lectures/lecture5.pdf)
4. [InverseGammaDistribution, Wolfram Documentation](https://reference.wolfram.com/language/ref/InverseGammaDistribution.html)
5. [R: The Pearson Type V (aka Inverse Gamma) Distribution, PearsonDS](https://search.r-project.org/CRAN/refmans/PearsonDS/html/PearsonV.html)
6. [18.7 Inverse gamma Distribution, Stan Functions Reference](https://mc-stan.org/docs/2_28/functions-reference/inverse-gamma-distribution.html)
7. [scipy.stats.invgamma, SciPy v1.18.0 Manual](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.invgamma.html)
8. [Andrew Gelman (2006). Prior distributions for variance parameters in hierarchical models. Bayesian Analysis 1(3): 515–533.](https://sites.stat.columbia.edu/gelman/bayescomputation/Gelman2006.pdf)
9. [Pearson distribution, ScientificLib](https://www.scientificlib.com/en/Mathematics/LX/PearsonDistribution.html)
10. [Bayesian inference chapter, Carnegie Mellon University course notes](https://www.stat.cmu.edu/~brian/463-2012/week09/Chapter%2003.pdf)
11. [Determination of Bayesian reliability sampling plans based on exponential-inverted gamma distribution, International Journal of Quality & Reliability Management 31(8): 950–962 (2014)](https://doi.org/10.1108/IJQRM-08-2013-0138)
12. [Section 5.2 Prior Specification and Conjugate Analysis, STAT 418](https://treese41528.github.io/ComputationalDataScience/Website/part3_bayesian/chapter5/ch5_2-prior-distributions.html)
13. [Zachary Brehm, Aaron Wagner, Erik VonKaenel, David Burton, Samuel J. Weisenthal, Martin Cole, Yiping Pang, Sally W. Thurston (2021). Selection of inverse gamma and half-t priors for hierarchical models: sensitivity and recommendations. arXiv:2108.12045.](https://arxiv.org/abs/2108.12045)
14. [Estimating an Inverse Gamma distribution. arXiv:1605.01019.](https://arxiv.org/abs/1605.01019)
15. [actuar: Loss Distribution Modeling, Casualty Actuarial Society](https://opensourcesoftware.casact.org/actuar)
16. [R: Inverse Gamma Distribution, Boom package](https://search.r-project.org/CRAN/refmans/Boom/html/invgamma.html)

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

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Probability theory › Probability distributions › Distribution families and classification › Continuous univariate distribution families

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/inverse-gamma-distribution

English original: https://www.edgepedia.org/inverse-gamma-distribution
