PTMLocScale#
- class liesel_ptm.PTMLocScale(knots, y, normalization_tau2, transition_width=0.3, scale_after_transformation=False, scaling_factor=None, shape_param_prior=ShapePrior.RANDOM_WALK)[source]#
Bases:
object
Penalized transformation model for location and scale.
- Parameters:
knots (
Any
) – The knots used to the define the transformation function.y (
Any
) – The observed response variable.normalization_tau2 (
Var
) – The variance parameter \(\tau^2_\delta\) for the prior of the transformation function’s shape parameters.transition_width (
float
) – The width of the transition segment of the transformation function. A number larger than 0, indicating the length in terms of a multiple of the range of interior knots. Called \(\lambda\). (default:0.3
)scale_after_transformation (
bool
) – Whether to scale the response variable after the transformation. It is not avisable to switch this toTrue
. (default:False
)scaling_factor (
Optional
[Var
]) – The scaling factor \(\omega\) for the transformation function. IfNone
, the scaling factor will be fixed to one. (default:None
)shape_param_prior (
ShapePrior
) – The prior distribution for the shape parameter. (default:<ShapePrior.RANDOM_WALK: 1>
)
Methods
Builds the model graph.
Initializes a penalized transformation model automatically from the desired number of shape parameters.
Given a Liesel model graph, this creates a new
PTMLocScale
with updated knots.Finds good knots for the transformation function.
Prepares a
liesel.goose.EngineBuilder
for MCMC sampling.Assembles a
pd.DataFrame
that gives information on the widely applicable information criterion for this model.Attributes
The knots of the transformation function's spline segment.
The transition width.
Predictor for the location model part.
Predictor for the log scale model part.
The exponential of
log_scale_model
.The hyperparameter \(\tau^2_\delta\).
Whether to scale the response variable after the transformation.
The scaling factor \(\omega\) for the transformation function.
The prior distribution for the shape parameter.
Intercept \(\beta_0\) of the location model part.
Exponential of the intercept \(\exp(\gamma_0)\) of the scale model part.
The response's location, including an intercept.
The response's scale, including an intercept.
The residuals.
Organizes the transformation model part \(h(\varepsilon\)).
Derivative of \(h(\varepsilon)\) with respect to the response.
Variable for the transformation model part \(h(\varepsilon\)).
The reference distribution, currently fixed to the standard normal distribution.
Response variable.
Names of the intercept nodes.