bartz.mcmcstep.Wishart¶
- class bartz.mcmcstep.Wishart(nu, rate, value)[source]¶
A precision matrix with a Wishart prior, bundled with its current value.
Represents a random precision (inverse covariance)
valuedrawn from a Wishart prior with degrees of freedomnuand rate matrixrate. The univariate case (k = 1) is the Gamma special case; the relationship to the inverse-gamma prior on the variance isalpha = nu / 2,beta = rate / 2. The prior mean of the precision isnu * rate^-1. Each marginal error variance (diagonal of the inverse) is inverse-gamma withalpha = inv_wishart_marginal_nu / 2,beta = rate_ii / 2.Set
nuandratetoNoneto represent a precision held fixed atvaluewith no prior (e.g. the identity in binary regression).- nu: Float32[Array, ''] | None¶
Degrees of freedom of the Wishart prior, or
Noneif there is no prior.
- rate: Float32[Array, ''] | Float32[Array, 'k k'] | None¶
The rate matrix of the Wishart prior (scalar for univariate), or
Noneif there is no prior. Equal to the inverse-gammascalein the univariate case.
- value: Float32[Array, '*chains k k'] | Float32[Array, '*chains']¶
The precision matrix (scalar for univariate).
- classmethod from_inv_wishart_marginal_nu(marginal_nu, rate, value)[source]¶
Build the prior from the degrees of freedom of each marginal variance.
Sets
nu = marginal_nu + k - 1, the inverse ofinv_wishart_marginal_nu.- Return type: