re#

superglm.re(
column: str,
*,
levels: Any = None,
unseen: Literal['population', 'error'] = 'population',
missing: Literal['error'] = 'error',
lambda_policy: LambdaPolicy | None = None,
) → BoundTerm#

Declare a random effect with a coefficient for every group level.

For example, re("broker") lets broker effects shrink toward the population value. Use fit_reml to estimate the variance component. This encoding does not drop a reference level.

Parameters:
columnstr

Name of the grouping column.

levelssequence, data column or categorical dtype, optional

Declare the allowed levels, including levels with no training rows.

unseen{“population”, “error”}, default=”population”

Prediction policy for unknown levels. "population" gives the random effect a contribution of zero on the predictor’s link scale.

missing{“error”}, default=”error”

Missing group labels raise an error.

lambda_policyLambdaPolicy, optional

Set the policy for the random effect’s smoothing penalty.

Returns:
BoundTerm

A random-effect declaration for the named column.

See also

RandomEffect

Level handling and variance-component estimation.

cat

Categorical encoding relative to a reference level.