statsmodels.base.model.Model

class statsmodels.base.model.Model(endog, exog=None, **kwargs)[source]

A (predictive) statistical model. Intended to be subclassed not used.

Parameters
endogarray_like

A 1-d endogenous response variable. The dependent variable.

exogarray_like

A nobs x k array where nobs is the number of observations and k is the number of regressors. An intercept is not included by default and should be added by the user. See statsmodels.tools.add_constant.

missingstr

Available options are ‘none’, ‘drop’, and ‘raise’. If ‘none’, no nan checking is done. If ‘drop’, any observations with nans are dropped. If ‘raise’, an error is raised. Default is ‘none’.

hasconstNone or bool

Indicates whether the RHS includes a user-supplied constant. If True, a constant is not checked for and k_constant is set to 1 and all result statistics are calculated as if a constant is present. If False, a constant is not checked for and k_constant is set to 0.

**kwargs

Extra arguments that are used to set model properties when using the formula interface.

Notes

endog and exog are references to any data provided. So if the data is already stored in numpy arrays and it is changed then endog and exog will change as well.

Attributes
exog_names

Names of exogenous variables.

endog_names

Names of endogenous variables.

Methods

fit()

Fit a model to data.

from_formula(formula, data[, subset, drop_cols])

Create a Model from a formula and dataframe.

predict(params[, exog])

After a model has been fit predict returns the fitted values.

Methods

fit()

Fit a model to data.

from_formula(formula, data[, subset, drop_cols])

Create a Model from a formula and dataframe.

predict(params[, exog])

After a model has been fit predict returns the fitted values.

Properties

endog_names

Names of endogenous variables.

exog_names

Names of exogenous variables.