9.5 Real Distribution Families
The distribution object constructors documented in this section return uniquely defined
distributions for the largest possible parameter domain. This usually means that they return
distributions for a larger domain than their mathematical counterparts are defined on.
For example, those that have a scale parameter, such as cauchy-dist
, are typically
undefined for a zero scale. However, in floating-point math, it is often useful to simulate
limits in finite time using special values like +inf.0
. Therefore, when a
scale-parameterized family’s constructor receives 0
, it returns a distribution object
that behaves like a Delta-Dist
Further, negative scales are accepted, even for exponential-dist
, which results in a
distribution with positive scale reflected about zero.
Some parameters’ boundary values give rise to non-unique limits. Sometimes the ambiguity
can be resolved using necessary properties; see Gamma-Dist for an example. When no
resolution exists, as with (beta-dist 0 0), which puts an indeterminate probability on
the value 0 and the rest on 1, the constructor returns an
Some distribution object constructors attempt to return sensible distributions when given
special values such as +inf.0 as parameters. Do not count on these yet.
Many distribution families, such as Gamma-Dist, can be parameterized on either scale
or rate (which is the reciprocal of scale). In all such cases, the implementations provided by
math/distributions are parameterized on scale.
9.5.1 Beta Distributions
Represents the beta distribution family parameterized by two shape parameters, or pseudocounts,
which must both be nonnegative.
(beta-dist 0 0) and (beta-dist +inf.0 +inf.0) are undefined distributions.
When a = 0 or b = +inf.0, the returned distribution acts like
When a = +inf.0 or b = 0, the returned distribution acts like
9.5.2 Cauchy Distributions
Represents the Cauchy distribution family parameterized by mode and scale.
9.5.3 Delta Distributions
Represents the family of distributions whose densities are Dirac delta functions.
9.5.4 Exponential Distributions
Represents the exponential distribution family parameterized by mean, or scale.
Warning: The exponential distribution family is often parameterized by rate, which
is the reciprocal of mean or scale. Construct exponential distributions from rates using
9.5.5 Gamma Distributions
Represents the gamma distribution family parameterized by shape and scale. The shape
parameter must be nonnegative.
Warning: The gamma distribution family is often parameterized by shape and rate,
which is the reciprocal of scale. Construct gamma distributions from rates using
The cdf of the gamma distribution with shape = 0
could return either 0.0
at x = 0
, depending on whether a double limit is taken with respect to
or with respect to x
first. However the limits are taken, the cdf
must return 1.0
for x > 0
. Because cdfs are right-continuous, the only correct
Therefore, a gamma distribution with shape = 0
behaves like (delta-dist 0)
9.5.6 Logistic Distributions
Represents the logistic distribution family parameterized by mean (also called “location”)
and scale. In this parameterization, the variance is (* 1/3 (sqr (* pi scale)))
9.5.7 Normal Distributions
Represents the normal distribution family parameterized by mean and standard deviation.
Warning: The normal distribution family is often parameterized by mean and variance,
which is the square of standard deviation. Construct normal distributions from variances using
9.5.8 Triangular Distributions
Represents the triangular distribution family parameterized by minimum, maximum and mode.
If min, mode and max are not in ascending order, they are sorted
before constructing the distribution object.
(triangle-dist c c c) for any real c behaves like a support-limited delta
distribution centered at c.
9.5.9 Truncated Distributions
Represents distributions like d
, but with zero density for x < min
for x > max
. The probability of the interval [min
] is renormalized
(truncated-dist d) is equivalent to (truncated-dist d -inf.0 +inf.0).
(truncated-dist d max) is equivalent to (truncated-dist d -inf.0 max).
If min > max, they are swapped before constructing the distribution object.
Samples are taken by applying the truncated distribution’s inverse cdf to uniform samples.
9.5.10 Uniform Distributions
Represents the uniform distribution family parameterized by minimum and maximum.
(uniform-dist) is equivalent to (uniform-dist 0 1).
(uniform-dist max) is equivalent to (uniform-dist 0 max). If max < min,
they are swapped before constructing the distribution object.
(uniform-dist x x) for any real x behaves like a support-limited delta
distribution centered at x.