statsmodels.discrete.discrete_model.MultinomialResults.predict#

MultinomialResults.predict(exog=None, transform=True, *args, **kwargs)[source]#

Predict the outcome probabilities, or other quantities, for exog

Calls self.model.predict with self.params as the first argument.

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.

*args

Additional arguments to pass to the model, see the predict method of the model for the details.

**kwargs

Additional keywords arguments to pass to the model, see the predict method of the model for the details.

Returns:
ndarray or DataFrame

An ndarray of shape (nobs, J) is returned if exog is not given or is not a pandas object. If exog is a DataFrame, or if the model was fit using a formula and exog is a DataFrame or a dict, a DataFrame with the row index of exog is returned. The columns of the DataFrame are the categories of the endogenous variable in the order of the columns of wendog and of names, so that the first column is the reference category.

Notes

The columns of the returned DataFrame are the categories as they are in endog, for example integers, floats, booleans or strings, and not their string representation. This differs from names, which are always strings. Integer valued floats are converted to integers if they can be represented exactly. The levels of a factor in R, and so the labels of the columns of the predicted probabilities of nnet::multinom, are always strings.

Changed in version 0.15.1: The columns of the returned DataFrame are the categories of endog. In previous versions they were 0, 1, …, J - 1.