Covariance Matrix Distributions
The covariance matrix distributions have support on symmetric, positive-definite
Wishart distribution
Probability density function
If
Distribution statement
W ~
wishart
(nu, Sigma)
Increment target log probability density with wishart_lupdf(W | nu, Sigma)
.
Stan functions
real
wishart_lpdf
(matrix W | real nu, matrix Sigma)
Return the log of the Wishart density for symmetric and positive-definite matrix W
given degrees of freedom nu
and symmetric and positive-definite scale matrix Sigma
.
real
wishart_lupdf
(matrix W | real nu, matrix Sigma)
Return the log of the Wishart density for symmetric and positive-definite matrix W
given degrees of freedom nu
and symmetric and positive-definite scale matrix Sigma
dropping constant additive terms.
matrix
wishart_rng
(real nu, matrix Sigma)
Generate a Wishart variate with degrees of freedom nu
and symmetric and positive-definite scale matrix Sigma
; may only be used in transformed data and generated quantities blocks.
Wishart distribution, Cholesky Parameterization
The Cholesky parameterization of the Wishart distribution uses a Cholesky factor for both the variate and the parameter. If
Probability density function
If
The probability functions will raise errors if
Stan functions
real
wishart_cholesky_lpdf
(matrix L_W | real nu, matrix L_S)
Return the log of the Wishart density for lower-triangular Cholesky factor L_W
given degrees of freedom nu
and lower-triangular Cholesky factor of the scale matrix L_S
.
real
wishart_cholesky_lupdf
(matrix L_W | real nu, matrix L_S)
Return the log of the Wishart density for lower-triangular Cholesky factor of L_W
given degrees of freedom nu
and lower-triangular Cholesky factor of the scale matrix L_S
dropping constant additive terms.
matrix
wishart_cholesky_rng
(real nu, matrix L_S)
Generate the Cholesky factor of a Wishart variate with degrees of freedom nu
and lower-triangular Cholesky factor of the scale matrix L_S
; may only be used in transformed data and generated quantities blocks
Inverse Wishart distribution
Probability density function
If
Distribution statement
W ~
inv_wishart
(nu, Sigma)
Increment target log probability density with inv_wishart_lupdf(W | nu, Sigma)
.
Stan functions
real
inv_wishart_lpdf
(matrix W | real nu, matrix Sigma)
Return the log of the inverse Wishart density for symmetric and positive-definite matrix W
given degrees of freedom nu
and symmetric and positive-definite scale matrix Sigma
.
real
inv_wishart_lupdf
(matrix W | real nu, matrix Sigma)
Return the log of the inverse Wishart density for symmetric and positive-definite matrix W
given degrees of freedom nu
and symmetric and positive-definite scale matrix Sigma
dropping constant additive terms.
matrix
inv_wishart_rng
(real nu, matrix Sigma)
Generate an inverse Wishart variate with degrees of freedom nu
and symmetric and positive-definite scale matrix Sigma
; may only be used in transformed data and generated quantities blocks.
Inverse Wishart distribution, Cholesky Parameterization
The Cholesky parameterization of the inverse Wishart distribution uses a Cholesky factor for both the variate and the parameter. If
Probability density function
If
The probability functions will raise errors if
Stan functions
real
inv_wishart_cholesky_lpdf
(matrix L_W | real nu, matrix L_S)
Return the log of the inverse Wishart density for lower-triangular Cholesky factor L_W
given degrees of freedom nu
and lower-triangular Cholesky factor of the scale matrix L_S
.
real
inv_wishart_cholesky_lupdf
(matrix L_W | real nu, matrix L_S)
Return the log of the inverse Wishart density for lower-triangular Cholesky factor of L_W
given degrees of freedom nu
and lower-triangular Cholesky factor of the scale matrix L_S
dropping constant additive terms.
matrix
inv_wishart_cholesky_rng
(real nu, matrix L_S)
Generate the Cholesky factor of an inverse Wishart variate with degrees of freedom nu
and lower-triangular Cholesky factor of the scale matrix L_S
; may only be used in transformed data and generated quantities blocks.