statsmodels.discrete.discrete_model.DiscreteResults.get_prediction

DiscreteResults.get_prediction(exog=None, transform=True, which='mean', linear=None, row_labels=None, average=False, agg_weights=None, y_values=None, **kwargs)[source]

Compute prediction results when endpoint transformation is valid.

Parameters:
exogarray_like, optional

The values for which you want to predict.

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.

whichstr

Which statistic is to be predicted. Default is “mean”. The available statistics and options depend on the model. see the model.predict docstring

linearbool

Linear has been replaced by the which keyword and will be deprecated. If linear is True, then which is ignored and the linear prediction is returned.

row_labelslist of str or None

If row_lables are provided, then they will replace the generated labels.

averagebool

If average is True, then the mean prediction is computed, that is, predictions are computed for individual exog and then the average over observation is used. If average is False, then the results are the predictions for all observations, i.e. same length as exog.

agg_weightsndarray, optional

Aggregation weights, only used if average is True. The weights are not normalized.

y_valuesNone or nd_array

Some predictive statistics like which=”prob” are computed at values of the response variable. If y_values is not None, then it will be used instead of the default set of y_values.

Warning: which="prob" for count models currently computes the pmf for all y=k up to max(endog). This can be a large array if the observed endog values are large. This will likely change so that the set of y_values will be chosen to limit the array size.

**kwargs

Some models can take additional keyword arguments, such as offset, exposure or additional exog in multi-part models like zero inflated models. See the predict method of the model for the details.

Returns:
prediction_resultsPredictionResults

The prediction results instance contains prediction and prediction variance and can on demand calculate confidence intervals and summary dataframe for the prediction.

Notes

Status: new in 0.14, experimental


Last update: Oct 03, 2024