MultivariateNormalSingular

MultivariateNormalSingular#

class liesel_gam.MultivariateNormalSingular(loc, scale, penalty, penalty_rank, validate_args=False, allow_nan_stats=True, name='MultivariateNormalSingular')[source]#

Bases: Distribution

Potentially rank-deficient multivariate Gaussian distribution used as a prior in structured additive terms.

Implements the tfp.distributions.Distribution interface.

Parameters:
  • loc (Array | ndarray | bool | number | bool | int | float | complex) – Location array of shape (B, J) where B is the batching dimension and J is the number of coefficients; the event shape of this distribution.

  • scale (Array | ndarray | bool | number | bool | int | float | complex) – Scale array of shape (B,), where B is the batching dimension. This is \(\tau = \sqrt{\tau^2}\).

  • penalty (Array | ndarray | bool | number | bool | int | float | complex) – Penalty matrix of shape (B, J, J), where B is the batching dimension and J is the number of coefficients; the event shape of this distribution.

  • penalty_rank (Array | ndarray | bool | number | bool | int | float | complex) – Array of shape (B,), where B is the batching dimension, giving the rank of the penalty matrix. This is required in addition to the penalty for computational efficiency, to avoid re-computing the rank of the penalty matrix in each execution.

See also

StrctTerm

Structured additive term object, a Liesel var that uses this distribution.

MultivariateNormalStructured

More general distribution, implementing the prior for tensor product terms.

Notes

The coefficient \(\boldsymbol{\beta} \in \mathbb{R}^{J \times 1}\) in a structured additive term 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)\]

with the potentially rank-deficient penalty matrix \(\mathbf{K}\) of rank \(\operatorname{rk}(\mathbf{K})\). The variance parameter \(\tau^2\) acts as an inverse smoothing parameter.

Sampling from this distribution.

Sampling from this distribution is implemented, but note that, if \(\mathbf{K}\) is rank-deficient, samples are drawn only from the stochastic part of the distribution; the constant part will remain fixed to zero. For sampling, we use a generalized inverse of the potentially rank-deficient penalty matrix \(\mathbf{K}\).

References

  • Kneib, T., Klein, N., Lang, S., & Umlauf, N. (2019). Modular regression—A Lego system for building structured additive distributional regression models with tensor product interactions. TEST, 28(1), 1–39. https://doi.org/10.1007/s11749-019-00631-z