Penalized Transformation Models in Liesel#

Installation#

The library can be installed from GitHub:

$ pip install git+https://github.com/liesel-devs/liesel-ptm.git#egg=liesel_ptm

Acknowledgements#

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öttingenFunded by DFG

API Reference#

Model

PTMLocScale

Penalized transformation model for location and scale.

PTMLocScalePredictions

Posterior predictions for a penalized transformation model.

ShapePrior

Used to define the prior for the shape parameters of the transformation function.

Predictor

Organizes the terms of a structured additive predictor.

Covariate terms

LinearTerm

Linear function of one or more covariates.

StructuredAdditiveTerm

Term in a structured additive predictor.

PSpline

A P-spline with second-order random walk prior.

RandomIntercept

A random intercept with iid normal prior in noncentered parameterization.

Variable classes

VarWeibull

A variable with a Weibull prior.

VarInverseGamma

A variable with an inverse gamma prior.

VarHalfCauchy

A variance parameter with a half Cauchy prior on its square root.

ScaleWeibull

A variable with a Weibull prior on its square.

ScaleInverseGamma

A variable with an inverse gamma prior on its square.

ScaleHalfCauchy

A scale parameter with a half Cauchy prior.

SymmetricallyBoundedScalar

Class for defining a scalar \(\omega\) with symmetrically bounded support around 1.

TransformedVar

Class for defining a possibly transformed variable.

Data generation

PTMLocScaleDataGen

Draws random samples from a location-scale transformation model.

sample_shape

Draws a random sample of the shape parameters \(\boldsymbol{\delta}\) from a first order random walk prior.

Helpers

nullspace_remover

Constructs a reparameterization matrix fo removing the nullspace from a penalty matrix of a structured additive predictor term.

diffpen

A P-spline penalty matrix based on diff-order differences.

sumzero_term

Matrix Z for reparameterization for sum-to-zero-constraint of a structured additive term.

sumzero_coef

Matrix Z for reparameterization for sum-to-zero-constraint of coefficients.

bspline_basis

Vectorized B-spline basis function evaluation.

kn

Create equidistant knots for B-Spline of the specified order.

Indices and tables#