term_ri#
- class liesel_ptm.term_ri(basis, scale, name, inference=None, coef_name=None)[source]#
Bases:
UserVar
Random-intercept (group-level) term.
The
term_ri
class implements a random intercept effect where the basis encodes group labels (integers) and each group receives a coefficient. The coefficients are centered and scaled by an associated scale parameter. This term is provided in a form convenient for mixed models and hierarchical specifications.- Parameters:
basis (
Basis
) – Basis object that must evaluate to a 1-D array of integer labels (group indices). The length of the unique labels defines the number of group-specific coefficients.scale (
Var
|Any
) – Scale parameter (or variable) for the random-intercept coefficients. Typically represents the standard deviation for the group effects.name (
str
) – Human-readable name for the term. Used to construct internal variable names whencoef_name
is not provided.inference (
Any
) – Inference specification forwarded to coefficient creation. (default:None
)coef_name (
str
|None
) – Name for the coefficient variable. IfNone
a default name is constructed fromname
. (default:None
)
- Raises:
ValueError – If
basis.value
is not one-dimensional (group index array).
Methods
Construct a random-intercept term with a custom scale.
Construct a random-intercept term with an inverse-gamma variance prior.
Attributes