statsmodels.discrete.discrete_model.MNLogit.score_factor#

MNLogit.score_factor(params)[source]#

Multinomial logit score factor for each observation.

The score factor is the residual (observed minus predicted probability) for each non-reference category. It has shape (nobs, J-1) where J is the number of outcome categories.

The full per-observation score is computed from the score factor as:

score_obs[i] = kron(score_factor[i], exog[i])

which produces a vector of length K * (J-1) per observation.

Parameters:
paramsarray_like

The parameters of the model, flattened in column-major order with shape (K * (J-1),).

Returns:
score_factorndarray, shape (nobs, J-1)

The residual for each observation and non-reference category.