AI Glossary / AI and machine learning / Advanced

Inverse-gamma distribution

Definition

The inverse-gamma distribution is a continuous probability distribution over positive numbers. It is the distribution of the reciprocal of a gamma-distributed variable under a matching parameter convention, and is often used in Bayesian models to represent uncertainty about a variance or another positive quantity.

What it means

A variance cannot be negative, and uncertainty about it can be asymmetric: modest values may be plausible while a long tail allows much larger ones. The inverse-gamma family can express that shape through positive shape and scale parameters.
Inverse refers to taking a reciprocal, not to reversing a cumulative probability calculation. An inverse-gamma distribution is also distinct from an inverse gamma function, which is a different mathematical concept.
The family is convenient in certain normal-data models because updating an inverse-gamma prior with observations produces another inverse-gamma distribution. That convenience does not make every parameter choice sensible or every use of the distribution appropriate.

How it works

Using shape alpha and scale beta, the density for x>0 is proportional to x raised to −alpha−1, multiplied by exp(−beta/x). Both parameters are positive. If a variable G has a gamma distribution with shape alpha and rate beta, then X=1/G has this inverse-gamma distribution.
The word rate matters: software that uses a gamma scale parameter would use 1/beta for G. In the stated inverse-gamma convention, the mean is beta/(alpha−1) when alpha>1. The variance exists only when alpha>2. A proper distribution can therefore lack a finite mean or variance, despite every draw being a finite positive number with probability one.

Three practical examples

  • A Bayesian analyst models uncertainty about residual variance in a normal observation model.
  • A simulation designer generates positive, right-skewed quantities under a clearly justified inverse-gamma assumption.
  • A reviewer checks how a variance prior changes predictions when only a small number of measurements are available.

Think of it this way

Think of a control dial that shows the reciprocal of another positive measurement. Very small readings on the original dial become very large readings on the reciprocal dial. This helps explain the long right tail. The analogy alone does not establish an inverse-gamma distribution: the original measurement must have the appropriate gamma distribution, and the parameter convention must match.

Worked example

Suppose X has an inverse-gamma distribution with shape alpha=3 and scale beta=4. Its mean is 4/(3−1)=2. Its variance is beta²/[(alpha−1)²(alpha−2)], giving 16/(4 times 1)=4.
Now use shape alpha=1.5 with the same scale. The mean exists and equals 4/0.5=8, but the variance does not exist because alpha is not greater than 2. This is a property of the mathematical tail, not a software failure.
To simulate the first example by reciprocation, draw G from a gamma distribution with shape 3 and rate 4, then compute 1/G. In software using gamma scale, specify scale 1/4. Entering scale 4 instead would generate a different distribution and could substantially distort any variance assumptions built on it.

Illustrative case study

Fictional case: Elm Analytics builds a normal measurement-error model with an inverse-gamma prior on error variance. A developer copies parameter names from a gamma routine that uses scale, while the model notes specify rate. The resulting prior predictive measurements are different in variability from what the team intended.
The team checks the parameter definitions, plots simulated prior predictive values and documents units. It also tests whether the prior is overly influential on the small dataset. The incident is resolved as a modeling and implementation issue rather than by increasing the number of posterior samples. This example illustrates parameter checking, not evidence for a particular recommended variance prior.

Common misconceptions and mistakes

Do not mix shape - rate and shape - scale conventions. Do not assume that small parameter values automatically create a harmless or noninformative prior. A heavy tail can make moments undefined and complicate interpretation.
The expected reciprocal is generally not the reciprocal of the expectation. A variance prior is not directly a prior on standard deviation; transforming between them changes the distribution. A good fit to positive data also requires examination of the observation process, rather than choosing this family solely because it cannot generate negative values.

Business use

Most business applications encounter inverse-gamma distributions inside statistical software rather than as a standalone prediction method. Their practical effect may be on forecast uncertainty, especially when data are scarce.
Ask analysts to explain the parameter convention, units and implied range of plausible variances. Prior predictive simulation often communicates those assumptions better than parameter values alone. Compare reasonable alternatives when the chosen prior materially affects a decision. Store the specification alongside model code so that a library change or reimplementation does not silently switch parameter meanings. Mathematical convenience should support, rather than replace, a defensible account of uncertainty.

People also ask

Can the distribution generate negative values?

No, its standard support is positive.

Does its mean always exist?

No. Under the stated convention, the shape must exceed 1.

Is inverse-gamma the inverse cumulative distribution of a gamma variable?

No. It is related through reciprocation of the random variable, not simply through a quantile-function name.

Check your understanding

A gamma routine uses scale, but your reciprocal construction requires gamma rate 5. What scale should you supply?

Answer: Use scale 1/5, assuming the routine follows the usual rate - scale relationship. Always confirm that convention in its documentation rather than relying on a parameter's informal label.

Related terms

  • Gamma distribution
  • Variance
  • Precision
  • Conjugate prior
  • Inverse-Wishart distribution
  • normal-inverse-gamma distribution
  • prior predictive checking

Learn next

Learn gamma rate and scale conventions next, then simulate a gamma variable and its reciprocal. Compare quantiles with the corresponding inverse-gamma implementation. Explore how the shape changes tail behavior and whether the summaries you intend to report actually exist.

More in AI and machine learning

  • Intelligent word recognition - Intelligent word recognition is a term for recognizing words in document images, particularly handwritten words, using information at the word level rather...
  • Interactive evolutionary computation - Interactive evolutionary computation is an optimization approach in which people evaluate candidate solutions and an evolutionary algorithm uses that...
  • Intersection over union - Intersection over union, often written IoU, is a measure of how much two regions overlap: the shared area divided by the total area they cover together...
  • Inverted Dirichlet distribution - The inverted Dirichlet distribution is a multivariate probability distribution over positive quantities.
  • Isotropic position - Isotropic position describes a normalization in which a vector distribution has equal second-moment spread in every direction.
  • Iteration - An iteration is one complete round of an improvement process: one training update, one tuning cycle or one review pass, after which the result is measured...

Sources

SciPy inverse-gamma documentation, density and scale convention consulted: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.invgamma.html. SciPy inverse-Wishart documentation confirms the one-dimensional relationship: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.invwishart.html. The reciprocal transformation, moment-existence thresholds and numerical examples were independently checked algebraically. The fictional case describes a convention mismatch without presuming the direction of its effect.

Previous: Inverse filtering Next: Inverse kinematics

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer