Unbounded Continuous Distributions
The unbounded univariate continuous probability distributions have support on all real numbers.
Normal distribution
Probability density function
If
Distribution statement
y ~
normal
(mu, sigma)
Increment target log probability density with normal_lupdf(y | mu, sigma)
.
Stan functions
real
normal_lpdf
(reals y | reals mu, reals sigma)
The log of the normal density of y given location mu and scale sigma
real
normal_lupdf
(reals y | reals mu, reals sigma)
The log of the normal density of y given location mu and scale sigma dropping constant additive terms.
real
normal_cdf
(reals y | reals mu, reals sigma)
The cumulative normal distribution of y given location mu and scale sigma; normal_cdf will underflow to 0 for Phi_approx
is more robust in the tails, but must be scaled and translated for anything other than a standard normal.
real
normal_lcdf
(reals y | reals mu, reals sigma)
The log of the cumulative normal distribution of y given location mu and scale sigma; normal_lcdf will underflow to log(Phi_approx(...))
is more robust in the tails, but must be scaled and translated for anything other than a standard normal.
real
normal_lccdf
(reals y | reals mu, reals sigma)
The log of the complementary cumulative normal distribution of y given location mu and scale sigma; normal_lccdf will overflow to 0 for log1m(Phi_approx(...))
is more robust in the tails, but must be scaled and translated for anything other than a standard normal.
R
normal_rng
(reals mu, reals sigma)
Generate a normal 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.
Standard normal distribution
The standard normal distribution is so-called because its parameters are the units for their respective operations—the location (mean) is zero and the scale (standard deviation) one. The standard normal is parameter-free, and the unit parameters allow considerable simplification of the expression for the density.
Distribution statement
y ~
std_normal
()
Increment target log probability density with std_normal_lupdf(y)
.
Stan functions
real
std_normal_lpdf
(reals y)
The standard normal (location zero, scale one) log probability density of y.
real
std_normal_lupdf
(reals y)
The standard normal (location zero, scale one) log probability density of y dropping constant additive terms.
real
std_normal_cdf
(reals y)
The cumulative standard normal distribution of y; std_normal_cdf will underflow to 0 for Phi_approx
is more robust in the tails.
real
std_normal_lcdf
(reals y)
The log of the cumulative standard normal distribution of y; std_normal_lcdf will underflow to log(Phi_approx(...))
is more robust in the tails.
real
std_normal_lccdf
(reals y)
The log of the complementary cumulative standard normal distribution of y; std_normal_lccdf will overflow to 0 for log1m(Phi_approx(...))
is more robust in the tails.
R
std_normal_qf
(T x)
Returns the value of the inverse standard normal cdf x
. The std_normal_qf
is equivalent to the inv_Phi
function.
R
std_normal_log_qf
(T x)
Return the value of the inverse standard normal cdf x
. This function is equivalent to std_normal_qf(exp(x))
but is more numerically stable.
real
std_normal_rng
()
Generate a normal variate with location zero and scale one; may only be used in transformed data and generated quantities blocks.
Normal-id generalized linear model (linear regression)
Stan also supplies a single function for a generalized linear model with normal distribution and identity link function, i.e. a function for a linear regression. This provides a more efficient implementation of linear regression than a manually written regression in terms of a normal distribution and matrix multiplication.
Probability distribution function
If
Distribution statement
y ~
normal_id_glm
(x, alpha, beta, sigma)
Increment target log probability density with normal_id_glm_lupdf(y | x, alpha, beta, sigma)
.
Stan functions
real
normal_id_glm_lpdf
(real y | matrix x, real alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(real y | matrix x, real alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
real
normal_id_glm_lpdf
(real y | matrix x, vector alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(real y | matrix x, vector alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
real
normal_id_glm_lpdf
(real y | matrix x, real alpha, vector beta, vector sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(real y | matrix x, real alpha, vector beta, vector sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
real
normal_id_glm_lpdf
(real y | matrix x, vector alpha, vector beta, vector sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(real y | matrix x, vector alpha, vector beta, vector sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
real
normal_id_glm_lpdf
(vector y | row_vector x, real alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(vector y | row_vector x, real alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
real
normal_id_glm_lpdf
(vector y | row_vector x, vector alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(vector y | row_vector x, vector alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
real
normal_id_glm_lpdf
(vector y | matrix x, real alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(vector y | matrix x, real alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
real
normal_id_glm_lpdf
(vector y | matrix x, vector alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(vector y | matrix x, vector alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
real
normal_id_glm_lpdf
(vector y | matrix x, real alpha, vector beta, vector sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(vector y | matrix x, real alpha, vector beta, vector sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
real
normal_id_glm_lpdf
(vector y | matrix x, vector alpha, vector beta, vector sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(vector y | matrix x, vector alpha, vector beta, vector sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
Exponentially modified normal distribution
Exponentially modified Gaussian describes the distribution of
Probability density function
If
Distribution statement
y ~
exp_mod_normal
(mu, sigma, lambda)
Increment target log probability density with exp_mod_normal_lupdf(y | mu, sigma, lambda)
.
Stan functions
real
exp_mod_normal_lpdf
(reals y | reals mu, reals sigma, reals lambda)
The log of the exponentially modified normal density of y given location mu, scale sigma, and rate lambda
real
exp_mod_normal_lupdf
(reals y | reals mu, reals sigma, reals lambda)
The log of the exponentially modified normal density of y given location mu, scale sigma, and rate lambda dropping constant additive terms
real
exp_mod_normal_cdf
(reals y | reals mu, reals sigma, reals lambda)
The exponentially modified normal cumulative distribution function of y given location mu, scale sigma, and rate lambda
real
exp_mod_normal_lcdf
(reals y | reals mu, reals sigma, reals lambda)
The log of the exponentially modified normal cumulative distribution function of y given location mu, scale sigma, and rate lambda
real
exp_mod_normal_lccdf
(reals y | reals mu, reals sigma, reals lambda)
The log of the exponentially modified normal complementary cumulative distribution function of y given location mu, scale sigma, and rate lambda
R
exp_mod_normal_rng
(reals mu, reals sigma, reals lambda)
Generate a exponentially modified normal variate with location mu, scale sigma, and rate lambda; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.
Skew normal distribution
Probability density function
If
Distribution statement
y ~
skew_normal
(xi, omega, alpha)
Increment target log probability density with skew_normal_lupdf(y | xi, omega, alpha)
.
Stan functions
real
skew_normal_lpdf
(reals y | reals xi, reals omega, reals alpha)
The log of the skew normal density of y given location xi, scale omega, and shape alpha
real
skew_normal_lupdf
(reals y | reals xi, reals omega, reals alpha)
The log of the skew normal density of y given location xi, scale omega, and shape alpha dropping constant additive terms
real
skew_normal_cdf
(reals y | reals xi, reals omega, reals alpha)
The skew normal distribution function of y given location xi, scale omega, and shape alpha
real
skew_normal_lcdf
(reals y | reals xi, reals omega, reals alpha)
The log of the skew normal cumulative distribution function of y given location xi, scale omega, and shape alpha
real
skew_normal_lccdf
(reals y | reals xi, reals omega, reals alpha)
The log of the skew normal complementary cumulative distribution function of y given location xi, scale omega, and shape alpha
R
skew_normal_rng
(reals xi, reals omega, real alpha)
Generate a skew normal variate with location xi, scale omega, and shape alpha; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.
Student-t distribution
Probability density function
If
Distribution statement
y ~
student_t
(nu, mu, sigma)
Increment target log probability density with student_t_lupdf(y | nu, mu, sigma)
.
Stan functions
real
student_t_lpdf
(reals y | reals nu, reals mu, reals sigma)
The log of the Student-
real
student_t_lupdf
(reals y | reals nu, reals mu, reals sigma)
The log of the Student-
real
student_t_cdf
(reals y | reals nu, reals mu, reals sigma)
The Student-
real
student_t_lcdf
(reals y | reals nu, reals mu, reals sigma)
The log of the Student-
real
student_t_lccdf
(reals y | reals nu, reals mu, reals sigma)
The log of the Student-
R
student_t_rng
(reals nu, reals mu, reals sigma)
Generate a Student-
Cauchy distribution
Probability density function
If
Distribution statement
y ~
cauchy
(mu, sigma)
Increment target log probability density with cauchy_lupdf(y | mu, sigma)
.
Stan functions
real
cauchy_lpdf
(reals y | reals mu, reals sigma)
The log of the Cauchy density of y given location mu and scale sigma
real
cauchy_lupdf
(reals y | reals mu, reals sigma)
The log of the Cauchy density of y given location mu and scale sigma dropping constant additive terms
real
cauchy_cdf
(reals y | reals mu, reals sigma)
The Cauchy cumulative distribution function of y given location mu and scale sigma
real
cauchy_lcdf
(reals y | reals mu, reals sigma)
The log of the Cauchy cumulative distribution function of y given location mu and scale sigma
real
cauchy_lccdf
(reals y | reals mu, reals sigma)
The log of the Cauchy complementary cumulative distribution function of y given location mu and scale sigma
R
cauchy_rng
(reals mu, reals sigma)
Generate a Cauchy 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.
Double exponential (Laplace) distribution
Probability density function
If
The double-exponential distribution can be defined as a compound exponential-normal distribution (Ding and Blitzstein 2018). Using the inverse scale parameterization for the exponential distribution, and the standard deviation parameterization for the normal distribution, one can write
Distribution statement
y ~
double_exponential
(mu, sigma)
Increment target log probability density with double_exponential_lupdf(y | mu, sigma)
.
Stan functions
real
double_exponential_lpdf
(reals y | reals mu, reals sigma)
The log of the double exponential density of y given location mu and scale sigma
real
double_exponential_lupdf
(reals y | reals mu, reals sigma)
The log of the double exponential density of y given location mu and scale sigma dropping constant additive terms
real
double_exponential_cdf
(reals y | reals mu, reals sigma)
The double exponential cumulative distribution function of y given location mu and scale sigma
real
double_exponential_lcdf
(reals y | reals mu, reals sigma)
The log of the double exponential cumulative distribution function of y given location mu and scale sigma
real
double_exponential_lccdf
(reals y | reals mu, reals sigma)
The log of the double exponential complementary cumulative distribution function of y given location mu and scale sigma
R
double_exponential_rng
(reals mu, reals sigma)
Generate a double exponential 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.
Logistic distribution
Probability density function
If
Distribution statement
y ~
logistic
(mu, sigma)
Increment target log probability density with logistic_lupdf(y | mu, sigma)
.
Stan functions
real
logistic_lpdf
(reals y | reals mu, reals sigma)
The log of the logistic density of y given location mu and scale sigma
real
logistic_lupdf
(reals y | reals mu, reals sigma)
The log of the logistic density of y given location mu and scale sigma dropping constant additive terms
real
logistic_cdf
(reals y | reals mu, reals sigma)
The logistic cumulative distribution function of y given location mu and scale sigma
real
logistic_lcdf
(reals y | reals mu, reals sigma)
The log of the logistic cumulative distribution function of y given location mu and scale sigma
real
logistic_lccdf
(reals y | reals mu, reals sigma)
The log of the logistic complementary cumulative distribution function of y given location mu and scale sigma
R
logistic_rng
(reals mu, reals sigma)
Generate a logistic 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.
Gumbel distribution
Probability density function
If
Distribution statement
y ~
gumbel
(mu, beta)
Increment target log probability density with gumbel_lupdf(y | mu, beta)
.
Stan functions
real
gumbel_lpdf
(reals y | reals mu, reals beta)
The log of the gumbel density of y given location mu and scale beta
real
gumbel_lupdf
(reals y | reals mu, reals beta)
The log of the gumbel density of y given location mu and scale beta dropping constant additive terms
real
gumbel_cdf
(reals y | reals mu, reals beta)
The gumbel cumulative distribution function of y given location mu and scale beta
real
gumbel_lcdf
(reals y | reals mu, reals beta)
The log of the gumbel cumulative distribution function of y given location mu and scale beta
real
gumbel_lccdf
(reals y | reals mu, reals beta)
The log of the gumbel complementary cumulative distribution function of y given location mu and scale beta
R
gumbel_rng
(reals mu, reals beta)
Generate a gumbel variate with location mu 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.
Skew double exponential distribution
Probability density function
If
Distribution statement
y ~
skew_double_exponential
(mu, sigma, tau)
Increment target log probability density with skew_double_exponential(y | mu, sigma, tau)
Stan functions
real
skew_double_exponential_lpdf
(reals y | reals mu, reals sigma, reals tau)
The log of the skew double exponential density of y given location mu, scale sigma and skewness tau
real
skew_double_exponential_lupdf
(reals y | reals mu, reals sigma, reals tau)
The log of the skew double exponential density of y given location mu, scale sigma and skewness tau dropping constant additive terms
real
skew_double_exponential_cdf
(reals y | reals mu, reals sigma, reals tau)
The skew double exponential cumulative distribution function of y given location mu, scale sigma and skewness tau
real
skew_double_exponential_lcdf
(reals y | reals mu, reals sigma, reals tau)
The log of the skew double exponential cumulative distribution function of y given location mu, scale sigma and skewness tau
real
skew_double_exponential_lccdf
(reals y | reals mu, reals sigma, reals tau)
The log of the skew double exponential complementary cumulative distribution function of y given location mu, scale sigma and skewness tau
R
skew_double_exponential_rng
(reals mu, reals sigma, reals tau)
Generate a skew double exponential variate with location mu, scale sigma and skewness tau; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.