bartz.mcmcstep.DiagWishart¶
- class bartz.mcmcstep.DiagWishart(nu, rate, value)[source]¶
A diagonal precision matrix with independent chi-square diagonal entries.
Despite the name this is not a Wishart restricted to diagonal matrices, but a convenience type: a diagonal precision whose entries are mutually independent, each with its own Gamma (scaled chi-square) prior. Only the multivariate (matrix) case is supported.
With the same
nuandrate, each component’s variance has the same prior as the corresponding marginal variance under the denseWishart: the gamma shape of each precision entry isinv_wishart_marginal_nu / 2, notnu / 2.A component with
rate0 has no prior; its precision is held fixed at itsvalue(1 for the binary components of a mixed regression).Used for mixed binary-continuous regression and for continuous multivariate regression with per-datapoint missingness.
- 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:
- property inv_wishart_marginal_nu: Float32[Array, ''] | None[source]¶
Degrees of freedom of the inverse-gamma marginal of each variance.
Equal to
nu - k + 1, orNoneif there is no prior.
- 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).