term.f_ig()

Contents

term.f_ig()#

classmethod term.f_ig(basis, fname='f', ig_concentration=1.0, ig_scale=0.005, inference=None, variance_value=100.0, noncentered=False)[source]#

Construct a smooth term with an inverse-gamma prior on the variance.

This convenience constructor creates a term similar to f() but sets up an explicit variance parameter with an Inverse-Gamma prior. A scale variable is set up by taking the square-root, and the coefficient prior uses the derived scale together with the basis penalty. By default a Gibbs-style initialization is attached to the variance inference via an internal kernel; an optional jitter distribution can be provided for MCMC initialization.

Parameters:
  • basis (Basis) – Basis object providing the design matrix and penalty.

  • fname (str) – Prefix used to build the term name (default: 'f'). (default: 'f')

  • ig_concentration (float) – Concentration (shape) parameter of the Inverse-Gamma prior for the variance. (default: 1.0)

  • ig_scale (float) – Scale parameter of the Inverse-Gamma prior for the variance. (default: 0.005)

  • inference (Any) – Inference specification forwarded to the coefficient variable creation, a liesel.goose.MCMCSpec. (default: None)

  • variance_value (float) – Initial value for the variance parameter. (default: 100.0)

  • noncentered (bool) – If True, reparameterize the term to non-centered form (see reparam_noncentered()). (default: False)

Return type:

term

Returns:

  • A term instance configured with an inverse-gamma prior on

  • the variance and an appropriate inference specification for

  • variance updates.

Notes

  • The variance parameter is named using a LaTeX-like representation "$\tau^2_{...}$" for readability in summaries.

Examples

Create a P-spline basis and wrap it into a term:

# assume x to be a 1d array.
b = ps(x, nbases=10)
t = term.f_ig(b)