Penalized Transformation Models in Liesel#

Penalized Transformation Models are a class of flexible structured additive distributional regression models. This is a Python library for estimating these models with Markov Chain Monte Carlo (MCMC) methods.

Learn more in the paper:

Brachem, J., Wiemann, P. F. V., & Kneib, T. (2024). Bayesian penalized transformation models: Structured additive location-scale regression for arbitrary conditional distributions (No. arXiv:2404.07440). arXiv. https://doi.org/10.48550/arXiv.2404.07440

Installation#

The library can be installed from GitHub:

$ pip install git+https://github.com/liesel-devs/liesel-ptm.git

Getting Started#

This is a simple example for first steps:

import liesel_ptm as ptm
import jax

y = jax.random.normal(jax.random.key(0), (50,))

model = ptm.LocScalePTM.new_ptm(y)
results = model.run_mcmc(seed=1, warmup=300, posterior=500)
samples = results.get_posterior_samples()

model.plot(samples)

dist = model.init_dist(samples) # initialize a distribution object

API Reference#

Model

LocScalePTM

A Penalized Transformation Model for Location and Scale.

TransformationDist

Transformation distribution using a spline and optional parametric component.

LocScaleTransformationDist

Location–scale specialization of TransformationDist.

term

General structured additive term.

term_ri

Random-intercept (group-level) term.

ps

Create a P-spline basis.

lin

Create a linear basis (design matrix) for a predictor.

ri

Create a random-intercept basis from grouping labels.

PTMKnots

Knots for a monotonically increasing PTM spline.

PTMCoef

Coefficient for PTM transformation splines.

ScaleWeibull

A variable with a Weibull prior on its square.

ScaleInverseGamma

A variable with an Inverse Gamma prior on its square.

Acknowledgements and Funding#

Liesel-PTM is developed by Johannes Brachem with support from Paul Wiemann and Thomas Kneib at the University of Göttingen. As a specialized extension, Liesel-PTM belongs to the Liesel project. We are grateful to the German Research Foundation (DFG) for funding the development through grant 443179956.

University of Göttingen Funded by DFG

Indices and tables#