statsmodels.regression.linear_model.OLSResults.get_prediction#

OLSResults.get_prediction(exog=None, transform=True, weights=None, row_labels=None, **kwargs)#

Compute prediction results

Parameters:
exogarray_like, optional

The values for which you want to predict. If the model was not fit using a formula, the columns are matched by position and not by name, so a DataFrame must have its columns in the same order as the exog used to fit the model. If None, then the model’s exog together with the offset and exposure stored in the model are used, as in predict. If exog is given, then the stored offset and exposure are not used unless they are passed explicitly in pred_kwds.

Changed in version 0.15.1: Without exog, the stored offset and exposure are now used.

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.

weightsNone or array_like, optional

Weights interpreted as in WLS, used for the variance of the predicted residual.

row_labelsNone or array_like, optional

A list of row labels to use. If not provided, read exog is available.

pred_kwdsdict, optional

Some models can take additional keyword arguments, see the predict method of the model for details.

Returns:
linear_model.PredictionResults

The prediction results instance contains prediction and prediction variance and can on demand calculate confidence intervals and summary tables for the prediction of the mean and of new observations.