pymargins.VariableInfo

class pymargins.VariableInfo(name: str, var_type: Literal['continuous', 'binary', 'categorical'], levels: list | None = None, support: tuple[float, float] | None = None, encoding: str | None = None)

Per-variable metadata used for at=typical averaging, contrast validation, and warning generation.

name

Variable name as used in the model’s formula or feature list.

Type:

str

var_type

One of “continuous”, “binary”, “categorical”.

Type:

str

levels

For categorical/binary variables, the set of valid level values. For ordered factors, the order is meaningful.

Type:

list, optional

support

For continuous variables, (min, max) observed in the fit data. Useful for warning when atexog= specifies a value far outside the observed range.

Type:

tuple, optional

encoding

How the variable is encoded in the design matrix (e.g., “treatment_coded”, “polynomial”, “one_hot”). Affects how scenario specifications map to design columns.

Type:

str, optional

__init__(name: str, var_type: Literal['continuous', 'binary', 'categorical'], levels: list | None = None, support: tuple[float, float] | None = None, encoding: str | None = None) None

Methods

__init__(name, var_type[, levels, support, ...])

Attributes

encoding

levels

support

name

var_type