Positive Continuous Distributions

The positive continuous probability functions have support on the positive real numbers.

Lognormal distribution

Probability density function

If \(\mu \in \mathbb{R}\) and \(\sigma \in \mathbb{R}^+\), then for \(y \in \mathbb{R}^+\), \[\begin{equation*} \text{LogNormal}(y|\mu,\sigma) = \frac{1}{\sqrt{2 \pi} \ \sigma} \, \frac{1}{y} \ \exp \! \left( - \, \frac{1}{2} \, \left( \frac{\log y - \mu}{\sigma} \right)^2 \right) . \end{equation*}\]

Sampling statement

y ~ lognormal(mu, sigma)

Increment target log probability density with lognormal_lupdf(y | mu, sigma).

Available since 2.0

Stan functions

real lognormal_lpdf(reals y | reals mu, reals sigma)
The log of the lognormal density of y given location mu and scale sigma

Available since 2.12

real lognormal_lupdf(reals y | reals mu, reals sigma)
The log of the lognormal density of y given location mu and scale sigma dropping constant additive terms

Available since 2.25

real lognormal_cdf(reals y | reals mu, reals sigma)
The cumulative lognormal distribution function of y given location mu and scale sigma

Available since 2.0

real lognormal_lcdf(reals y | reals mu, reals sigma)
The log of the lognormal cumulative distribution function of y given location mu and scale sigma

Available since 2.12

real lognormal_lccdf(reals y | reals mu, reals sigma)
The log of the lognormal complementary cumulative distribution function of y given location mu and scale sigma

Available since 2.12

R lognormal_rng(reals mu, reals sigma)
Generate a lognormal variate with location mu and scale sigma; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.

Available since 2.22

Chi-square distribution

Probability density function

If \(\nu \in \mathbb{R}^+\), then for \(y \in \mathbb{R}^+\), \[\begin{equation*} \text{ChiSquare}(y|\nu) = \frac{2^{-\nu/2}} {\Gamma(\nu / 2)} \, y^{\nu/2 - 1} \, \exp \! \left( -\, \frac{1}{2} \, y \right) . \end{equation*}\]

Sampling statement

y ~ chi_square(nu)

Increment target log probability density with chi_square_lupdf(y | nu).

Available since 2.0

Stan functions

real chi_square_lpdf(reals y | reals nu)
The log of the Chi-square density of y given degrees of freedom nu

Available since 2.12

real chi_square_lupdf(reals y | reals nu)
The log of the Chi-square density of y given degrees of freedom nu dropping constant additive terms

Available since 2.25

real chi_square_cdf(reals y | reals nu)
The Chi-square cumulative distribution function of y given degrees of freedom nu

Available since 2.0

real chi_square_lcdf(reals y | reals nu)
The log of the Chi-square cumulative distribution function of y given degrees of freedom nu

Available since 2.12

real chi_square_lccdf(reals y | reals nu)
The log of the complementary Chi-square cumulative distribution function of y given degrees of freedom nu

Available since 2.12

R chi_square_rng(reals nu)
Generate a Chi-square variate with degrees of freedom nu; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.

Available since 2.18

Inverse chi-square distribution

Probability density function

If \(\nu \in \mathbb{R}^+\), then for \(y \in \mathbb{R}^+\), \[\begin{equation*} \text{InvChiSquare}(y \, | \, \nu) = \frac{2^{-\nu/2}} {\Gamma(\nu / 2)} \, y^{-\nu/2 - 1} \, \exp\! \left( \! - \, \frac{1}{2} \, \frac{1}{y} \right) . \end{equation*}\]

Sampling statement

y ~ inv_chi_square(nu)

Increment target log probability density with inv_chi_square_lupdf(y | nu).

Available since 2.0

Stan functions

real inv_chi_square_lpdf(reals y | reals nu)
The log of the inverse Chi-square density of y given degrees of freedom nu

Available since 2.12

real inv_chi_square_lupdf(reals y | reals nu)
The log of the inverse Chi-square density of y given degrees of freedom nu dropping constant additive terms

Available since 2.25

real inv_chi_square_cdf(reals y | reals nu)
The inverse Chi-squared cumulative distribution function of y given degrees of freedom nu

Available since 2.0

real inv_chi_square_lcdf(reals y | reals nu)
The log of the inverse Chi-squared cumulative distribution function of y given degrees of freedom nu

Available since 2.12

real inv_chi_square_lccdf(reals y | reals nu)
The log of the inverse Chi-squared complementary cumulative distribution function of y given degrees of freedom nu

Available since 2.12

R inv_chi_square_rng(reals nu)
Generate an inverse Chi-squared variate with degrees of freedom nu; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.

Available since 2.18

Scaled inverse chi-square distribution

Probability density function

If \(\nu \in \mathbb{R}^+\) and \(\sigma \in \mathbb{R}^+\), then for \(y \in \mathbb{R}^+\), \[\begin{equation*} \text{ScaledInvChiSquare}(y|\nu,\sigma) = \frac{(\nu / 2)^{\nu/2}} {\Gamma(\nu / 2)} \, \sigma^{\nu} \, y^{-(\nu/2 + 1)} \, \exp \! \left( \! - \, \frac{1}{2} \, \nu \, \sigma^2 \, \frac{1}{y} \right) . \end{equation*}\]

Sampling statement

y ~ scaled_inv_chi_square(nu, sigma)

Increment target log probability density with scaled_inv_chi_square_lupdf(y | nu, sigma).

Available since 2.0

Stan functions

real scaled_inv_chi_square_lpdf(reals y | reals nu, reals sigma)
The log of the scaled inverse Chi-square density of y given degrees of freedom nu and scale sigma

Available since 2.12

real scaled_inv_chi_square_lupdf(reals y | reals nu, reals sigma)
The log of the scaled inverse Chi-square density of y given degrees of freedom nu and scale sigma dropping constant additive terms

Available since 2.25

real scaled_inv_chi_square_cdf(reals y | reals nu, reals sigma)
The scaled inverse Chi-square cumulative distribution function of y given degrees of freedom nu and scale sigma

Available since 2.0

real scaled_inv_chi_square_lcdf(reals y | reals nu, reals sigma)
The log of the scaled inverse Chi-square cumulative distribution function of y given degrees of freedom nu and scale sigma

Available since 2.12

real scaled_inv_chi_square_lccdf(reals y | reals nu, reals sigma)
The log of the scaled inverse Chi-square complementary cumulative distribution function of y given degrees of freedom nu and scale sigma

Available since 2.12

R scaled_inv_chi_square_rng(reals nu, reals sigma)
Generate a scaled inverse Chi-squared variate with degrees of freedom nu and scale sigma; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.

Available since 2.18

Exponential distribution

Probability density function

If \(\beta \in \mathbb{R}^+\), then for \(y \in \mathbb{R}^+\), \[\begin{equation*} \text{Exponential}(y|\beta) = \beta \, \exp ( - \beta \, y ) . \end{equation*}\]

Sampling statement

y ~ exponential(beta)

Increment target log probability density with exponential_lupdf(y | beta).

Available since 2.0

Stan functions

real exponential_lpdf(reals y | reals beta)
The log of the exponential density of y given inverse scale beta

Available since 2.12

real exponential_lupdf(reals y | reals beta)
The log of the exponential density of y given inverse scale beta dropping constant additive terms

Available since 2.25

real exponential_cdf(reals y | reals beta)
The exponential cumulative distribution function of y given inverse scale beta

Available since 2.0

real exponential_lcdf(reals y | reals beta)
The log of the exponential cumulative distribution function of y given inverse scale beta

Available since 2.12

real exponential_lccdf(reals y | reals beta)
The log of the exponential complementary cumulative distribution function of y given inverse scale beta

Available since 2.12

R exponential_rng(reals beta)
Generate an exponential variate with inverse scale beta; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.

Available since 2.18

Gamma distribution

Probability density function

If \(\alpha \in \mathbb{R}^+\) and \(\beta \in \mathbb{R}^+\), then for \(y \in \mathbb{R}^+\), \[\begin{equation*} \text{Gamma}(y|\alpha,\beta) = \frac{\beta^{\alpha}} {\Gamma(\alpha)} \, y^{\alpha - 1} \exp(-\beta \, y) . \end{equation*}\]

Sampling statement

y ~ gamma(alpha, beta)

Increment target log probability density with gamma_lupdf(y | alpha, beta).

Available since 2.0

Stan functions

real gamma_lpdf(reals y | reals alpha, reals beta)
The log of the gamma density of y given shape alpha and inverse scale beta

Available since 2.12

real gamma_lupdf(reals y | reals alpha, reals beta)
The log of the gamma density of y given shape alpha and inverse scale beta dropping constant additive terms

Available since 2.25

real gamma_cdf(reals y | reals alpha, reals beta)
The cumulative gamma distribution function of y given shape alpha and inverse scale beta

Available since 2.0

real gamma_lcdf(reals y | reals alpha, reals beta)
The log of the cumulative gamma distribution function of y given shape alpha and inverse scale beta

Available since 2.12

real gamma_lccdf(reals y | reals alpha, reals beta)
The log of the complementary cumulative gamma distribution function of y given shape alpha and inverse scale beta

Available since 2.12

R gamma_rng(reals alpha, reals beta)
Generate a gamma variate with shape alpha and inverse scale beta; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.

Available since 2.18

Inverse gamma Distribution

Probability density function

If \(\alpha \in \mathbb{R}^+\) and \(\beta \in \mathbb{R}^+\), then for \(y \in \mathbb{R}^+\), \[\begin{equation*} \text{InvGamma}(y|\alpha,\beta) = \frac{\beta^{\alpha}} {\Gamma(\alpha)} \ y^{-(\alpha + 1)} \, \exp \! \left( \! - \beta \, \frac{1}{y} \right) . \end{equation*}\]

Sampling statement

y ~ inv_gamma(alpha, beta)

Increment target log probability density with inv_gamma_lupdf(y | alpha, beta).

Available since 2.0

Stan functions

real inv_gamma_lpdf(reals y | reals alpha, reals beta)
The log of the inverse gamma density of y given shape alpha and scale beta

Available since 2.12

real inv_gamma_lupdf(reals y | reals alpha, reals beta)
The log of the inverse gamma density of y given shape alpha and scale beta dropping constant additive terms

Available since 2.25

real inv_gamma_cdf(reals y | reals alpha, reals beta)
The inverse gamma cumulative distribution function of y given shape alpha and scale beta

Available since 2.0

real inv_gamma_lcdf(reals y | reals alpha, reals beta)
The log of the inverse gamma cumulative distribution function of y given shape alpha and scale beta

Available since 2.12

real inv_gamma_lccdf(reals y | reals alpha, reals beta)
The log of the inverse gamma complementary cumulative distribution function of y given shape alpha and scale beta

Available since 2.12

R inv_gamma_rng(reals alpha, reals beta)
Generate an inverse gamma variate with shape alpha and scale beta; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.

Available since 2.18

Weibull distribution

Probability density function

If \(\alpha \in \mathbb{R}^+\) and \(\sigma \in \mathbb{R}^+\), then for \(y \in [0,\infty)\), \[\begin{equation*} \text{Weibull}(y|\alpha,\sigma) = \frac{\alpha}{\sigma} \, \left( \frac{y}{\sigma} \right)^{\alpha - 1} \, \exp \! \left( \! - \left( \frac{y}{\sigma} \right)^{\alpha} \right) . \end{equation*}\]

Note that if \(Y \propto \text{Weibull}(\alpha,\sigma)\), then \(Y^{-1} \propto \text{Frechet}(\alpha,\sigma^{-1})\).

Sampling statement

y ~ weibull(alpha, sigma)

Increment target log probability density with weibull_lupdf(y | alpha, sigma).

Available since 2.0

Stan functions

real weibull_lpdf(reals y | reals alpha, reals sigma)
The log of the Weibull density of y given shape alpha and scale sigma

Available since 2.12

real weibull_lupdf(reals y | reals alpha, reals sigma)
The log of the Weibull density of y given shape alpha and scale sigma dropping constant additive terms

Available since 2.25

real weibull_cdf(reals y | reals alpha, reals sigma)
The Weibull cumulative distribution function of y given shape alpha and scale sigma

Available since 2.0

real weibull_lcdf(reals y | reals alpha, reals sigma)
The log of the Weibull cumulative distribution function of y given shape alpha and scale sigma

Available since 2.12

real weibull_lccdf(reals y | reals alpha, reals sigma)
The log of the Weibull complementary cumulative distribution function of y given shape alpha and scale sigma

Available since 2.12

R weibull_rng(reals alpha, reals sigma)
Generate a weibull variate with shape alpha and scale sigma; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.

Available since 2.18

Frechet distribution

Probability density function

If \(\alpha \in \mathbb{R}^+\) and \(\sigma \in \mathbb{R}^+\), then for \(y \in \mathbb{R}^+\), \[\begin{equation*} \text{Frechet}(y|\alpha,\sigma) = \frac{\alpha}{\sigma} \, \left( \frac{y}{\sigma} \right)^{-\alpha - 1} \, \exp \! \left( \! - \left( \frac{y}{\sigma} \right)^{-\alpha} \right) . \end{equation*}\]

Note that if \(Y \propto \text{Frechet}(\alpha,\sigma)\), then \(Y^{-1} \propto \text{Weibull}(\alpha,\sigma^{-1})\).

Sampling statement

y ~ frechet(alpha, sigma)

Increment target log probability density with frechet_lupdf(y | alpha, sigma).

Available since 2.5

Stan functions

real frechet_lpdf(reals y | reals alpha, reals sigma)
The log of the Frechet density of y given shape alpha and scale sigma

Available since 2.12

real frechet_lupdf(reals y | reals alpha, reals sigma)
The log of the Frechet density of y given shape alpha and scale sigma dropping constant additive terms

Available since 2.25

real frechet_cdf(reals y | reals alpha, reals sigma)
The Frechet cumulative distribution function of y given shape alpha and scale sigma

Available since 2.5

real frechet_lcdf(reals y | reals alpha, reals sigma)
The log of the Frechet cumulative distribution function of y given shape alpha and scale sigma

Available since 2.12

real frechet_lccdf(reals y | reals alpha, reals sigma)
The log of the Frechet complementary cumulative distribution function of y given shape alpha and scale sigma

Available since 2.12

R frechet_rng(reals alpha, reals sigma)
Generate a Frechet variate with shape alpha and scale sigma; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.

Available since 2.18

Rayleigh distribution

Probability density function

If \(\sigma \in \mathbb{R}^+\), then for \(y \in [0,\infty)\), \[\begin{equation*} \text{Rayleigh}(y|\sigma) = \frac{y}{\sigma^2} \exp(-y^2 / 2\sigma^2) \!. \end{equation*}\]

Sampling statement

y ~ rayleigh(sigma)

Increment target log probability density with rayleigh_lupdf(y | sigma).

Available since 2.0

Stan functions

real rayleigh_lpdf(reals y | reals sigma)
The log of the Rayleigh density of y given scale sigma

Available since 2.12

real rayleigh_lupdf(reals y | reals sigma)
The log of the Rayleigh density of y given scale sigma dropping constant additive terms

Available since 2.25

real rayleigh_cdf(real y | real sigma)
The Rayleigh cumulative distribution of y given scale sigma

Available since 2.0

real rayleigh_lcdf(real y | real sigma)
The log of the Rayleigh cumulative distribution of y given scale sigma

Available since 2.12

real rayleigh_lccdf(real y | real sigma)
The log of the Rayleigh complementary cumulative distribution of y given scale sigma

Available since 2.12

R rayleigh_rng(reals sigma)
Generate a Rayleigh variate with scale sigma; may only be used in generated quantities block. For a description of argument and return types, see section vectorized PRNG functions.

Available since 2.18

Log-logistic distribution

Probability density function

If \(\alpha, \beta \in \mathbb{R}^+\), then for \(y \in \mathbb{R}^+\), \[\begin{equation*} \text{Log-Logistic}(y|\alpha,\beta) = \frac{\ \left(\frac{\beta}{\alpha}\right) \left(\frac{y}{\alpha}\right)^{\beta-1}\ }{\left(1 + \left(\frac{y}{\alpha}\right)^\beta\right)^2} . \end{equation*}\]

Sampling statement

y ~ loglogistic(alpha, beta)

Increment target log probability density with unnormalized version of loglogistic_lpdf(y | alpha, beta)

Available since 2.29

Stan functions

real loglogistic_lpdf(reals y | reals alpha, reals beta)
The log of the log-logistic density of y given scale alpha and shape beta

Available since 2.29

real loglogistic_cdf(reals y | reals alpha, reals beta)
The log-logistic cumulative distribution function of y given scale alpha and shape beta

Available since 2.29

R loglogistic_rng(reals alpha, reals beta)
Generate a log-logistic variate with scale alpha and shape beta; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.

Available since 2.29
Back to top