This is an old version, view current version.

14.7 Cumulative distribution functions

For most of the univariate probability functions, there is a corresponding cumulative distribution function, log cumulative distribution function, and log complementary cumulative distribution function.

For a univariate random variable Y with probability function pY(y|θ), the cumulative distribution function (CDF) FY is defined by FY(y) = Pr[Yy] = yp(y|θ) dy. The complementary cumulative distribution function (CCDF) is defined as Pr[Y>y] = 1FY(y). The reason to use CCDFs instead of CDFs in floating-point arithmetic is that it is possible to represent numbers very close to 0 (the closest you can get is roughly 10300), but not numbers very close to 1 (the closest you can get is roughly 11015).

In Stan, there is a cumulative distribution function for each probability function. For instance, normal_cdf(y, mu, sigma) is defined by yNormal(y|μ,σ) dy. There are also log forms of the CDF and CCDF for most univariate distributions. For example, normal_lcdf(y | mu, sigma) is defined by log(yNormal(y|μ,σ) dy) and normal_lccdf(y | mu, sigma) is defined by log(1yNormal(y|μ,σ) dy).