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.predictwithself.paramsas 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.
- exogarray_like,
- Returns:
ndarrayorDataFrameAn ndarray of shape (nobs, J) is returned if
exogis not given or is not a pandas object. Ifexogis a DataFrame, or if the model was fit using a formula andexogis a DataFrame or a dict, a DataFrame with the row index ofexogis returned. The columns of the DataFrame are the categories of the endogenous variable in the order of the columns ofwendogand ofnames, 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 fromnames, 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 ofnnet::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.