design_matrices

design_matrices(formula, data, na_action='drop', env=0, extra_namespace=None)

Parse and materialize a model formula into a DesignMatrices.

A DesignMatrices object contains objects representing the response and the design matrices for both the common and group specific effects.

Parameters

formula : str

A model formula.

data : pandas.DataFrame

The data frame where variables in the formula are taken from.

na_action : str = 'drop'

Describes what to do with missing values in data. "drop" means to drop all rows with a missing value, "error" means to raise an error, "pass" means to keep all. Defaults to "drop".

env : integer = 0

The number of environments we walk up in the stack starting from the function’s caller to capture the environment where formula is evaluated. Defaults to 0 which means the evaluation environment is the environment where design_matrices is called.

extra_namespace : dict = None

Additional user supplied transformations to include in the environment where the formula is evaluated. Defaults to None.

Returns

design : DesignMatrices

An instance of DesignMatrices that contains the design matrix or matrices described by formula.