RITerm

Contents

RITerm#

class liesel_gam.RITerm(basis, penalty, scale, name='', inference=None, coef_name=None, _update_on_init=True, validate_scalar_scale=True)[source]#

Bases: IndexingTerm

Term object for memory-efficient representation of independent random intercepts.

Specialized subclass of IndexingTerm, which itself is derived from StrctTerm.

Examples

>>> import pandas as pd
>>> import liesel_gam as gam
>>> df = pd.DataFrame({"group": ["a", "b", "a"]})
>>> term = gam.TermBuilder.from_df(df).ri("group", scale=1.0)
>>> term.nclusters
2
>>> term.labels
['a', 'b']

Attributes

labels

List of labels for all clusters represented by this term.

mapping

A label-integer mapping for the clusters in this term.

nclusters

Number of clusters represented by this random-intercept term.