statsmodels.base.model.Results.predict¶
method
-
Results.
predict
(exog=None, transform=True, *args, **kwargs)[source]¶ Call self.model.predict with self.params as the first argument.
- Parameters
- exogarray-like, optional
The values for which you want to predict. see Notes below.
- transformbool, optional
If the model was fit via a formula, do you want to pass exog through the formula. Default is True. E.g., if you fit a model y ~ log(x1) + log(x2), and transform is True, then you can pass a data structure that contains x1 and x2 in their original form. Otherwise, you’d need to log the data first.
- args, kwargs :
Some models can take additional arguments or keywords, see the predict method of the model for the details.
- Returns
- predictionndarray, pandas.Series or pandas.DataFrame
See self.model.predict
Notes
The types of exog that are supported depends on whether a formula was used in the specification of the model.
If a formula was used, then exog is processed in the same way as the original data. This transformation needs to have key access to the same variable names, and can be a pandas DataFrame or a dict like object that contains numpy arrays.
If no formula was used, then the provided exog needs to have the same number of columns as the original exog in the model. No transformation of the data is performed except converting it to a numpy array.
Row indices as in pandas data frames are supported, and added to the returned prediction.