ScaleIG

Contents

ScaleIG#

class liesel_gam.ScaleIG(value, concentration, scale, name='', variance_name='')[source]#

Bases: UserVar

A variable with an Inverse Gamma prior on its square.

The variance parameter (i.e. the squared scale) is flagged as a parameter.

Parameters:

Notes

This class assumes that this variable represents the scale parameter \(\tau\) in a structured additive term prior as described in StrctTerm.

This class allows for easy setup of Gibbs sampling for \(\tau^2\) via setup_gibbs_inference(). The Gibbs sampler is defined as follows.

We have

\[\tau^2 \sim \operatorname{InverseGamma}(a, b),\]

where a is the init argument concentration and b is the init argument scale for ScaleIG. The value of this variable (ScaleIG) is \(\tau = \sqrt{\tau^2}\).

In a structured additive term, the coefficient \(\boldsymbol{\beta} \in \mathbb{R}^J\) receives a potentially rank-deficient multivariate normal prior

\[p(\boldsymbol{\beta}) \propto \left(\frac{1}{\tau^2}\right)^{ \operatorname{rk}(\mathbf{K})/2} \exp \left( - \frac{1}{\tau^2} \boldsymbol{\beta}^\top \mathbf{K} \boldsymbol{\beta} \right).\]

The full conditional distribution for \(\tau^2\) is then an inverse Gamma distribtion:

\[\tau^2 | \cdot \sim \operatorname{InverseGamma}(\tilde{a}, \tilde{b})\]

with parameters

\[\begin{split}\tilde{a} & = a + 0.5 \operatorname{rk}(\mathbf{K}) \\ \tilde{b} & = b + 0.5 \boldsymbol{\beta}^\top \mathbf{K} \boldsymbol{\beta}.\end{split}\]

The Gibbs sampler for \(\tau^2\) repeatedly draws from this full conditional.

References

Section 9.6.3 in

Fahrmeir, L., Kneib, T., Lang, S., & Marx, B. (2013). Regression—Models, methods and applications. Springer. https://doi.org/10.1007/978-3-642-34333-9

Methods

setup_gibbs_inference

Sets up a liesel.goose.GibbsKernel for this variable, assuming that it is used as the variance parameter in a structured additive term.

setup_gibbs_inference_factored