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
A Penalized Transformation Model for Location and Scale. |
|
Transformation distribution using a spline and optional parametric component. |
|
Location–scale specialization of |
|
General structured additive term. |
|
Random-intercept (group-level) term. |
|
Create a P-spline basis. |
|
Create a linear basis (design matrix) for a predictor. |
|
Create a random-intercept basis from grouping labels. |
|
Knots for a monotonically increasing PTM spline. |
|
Coefficient for PTM transformation splines. |
|
A variable with a Weibull prior on its square. |
|
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.