statsmodels.discrete.discrete_model.MNLogit.hessian_factor#
- MNLogit.hessian_factor(params)[source]#
Multinomial logit Hessian weights for each observation.
For MNLogit the Hessian has a block structure that cannot be reduced to a single scalar weight per observation. Instead, each observation contributes a (J-1, J-1) weight matrix, so the full Hessian for design matrix X is:
H[j,l] = sum_i w[i,j,l] * X[i] @ X[i].T
- The weight for observation i is:
w[i,j,l] = -pr[i,j] * (1(j==l) - pr[i,l])
- Parameters:
- paramsarray_like
The parameters of the model, flattened in column-major order with shape (K * (J-1),).
- Returns:
- hessian_factor
ndarray,shape(nobs, J-1, J-1) The per-observation weight matrix for the Hessian.
- hessian_factor