statsmodels.discrete.count_model.GenericZeroInflated.from_formula

method

classmethod GenericZeroInflated.from_formula(formula, data, subset=None, drop_cols=None, *args, **kwargs)

Create a Model from a formula and dataframe.

Parameters
formulastr or generic Formula object

The formula specifying the model

dataarray-like

The data for the model. See Notes.

subsetarray-like

An array-like object of booleans, integers, or index values that indicate the subset of df to use in the model. Assumes df is a pandas.DataFrame

drop_colsarray-like

Columns to drop from the design matrix. Cannot be used to drop terms involving categoricals.

argsextra arguments

These are passed to the model

kwargsextra keyword arguments

These are passed to the model with one exception. The eval_env keyword is passed to patsy. It can be either a patsy.EvalEnvironment object or an integer indicating the depth of the namespace to use. For example, the default eval_env=0 uses the calling namespace. If you wish to use a “clean” environment set eval_env=-1.

Returns
modelModel instance

Notes

data must define __getitem__ with the keys in the formula terms args and kwargs are passed on to the model instantiation. E.g., a numpy structured or rec array, a dictionary, or a pandas DataFrame.