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 nu and rate, each component’s variance has the same prior as the corresponding marginal variance under the dense Wishart: the gamma shape of each precision entry is inv_wishart_marginal_nu / 2, not nu / 2.

A component with rate 0 has no prior; its precision is held fixed at its value (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 of inv_wishart_marginal_nu.

Return type:

Wishart

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, or None if there is no prior.

nu: Float32[Array, ''] | None

Degrees of freedom of the Wishart prior, or None if there is no prior.

rate: Float32[Array, ''] | Float32[Array, 'k k'] | None

The rate matrix of the Wishart prior (scalar for univariate), or None if there is no prior. Equal to the inverse-gamma scale in the univariate case.

value: Float32[Array, '*chains k k'] | Float32[Array, '*chains']

The precision matrix (scalar for univariate).