How to fix the problem "operands could not be broadcast together with shapes" on get_margeff in statsmodels with dummy=True?

14 views Asked by At

I have a problem with my multinomial logistic regression on statsmodels. I have dummies in my independant variables and when I put the option "dummy=True" on get_margeff I have this problem :

D:\Anaconda\lib\site-packages\statsmodels\discrete\discrete_model.py in _derivative_predict(self, params, exog, transform)
    853         X = np.tile(exog, J-1)
    854         # this is the derivative wrt the base level
--> 855         F0 = -repeat_eXB * X / sum_eXB ** 2
    856         # this is the derivative wrt the other levels when
    857         # dF_j / dParams_j (ie., own equation)

ValueError: operands could not be broadcast together with shapes (1,12) (1,6) 

I haven't missing values on my data

my code :

from statsmodels.api import MNLogit
from statsmodels.tools.tools import add_constant


#Y = pd.Categorical(TAB2["result"], categories=[3,2,1,0], ordered = True)
Y = TAB2["result"].astype(int)
X = TAB2[["D"]]
X = add_constant(X)

MODELE = MNLogit(Y, X, missing="drop")

RES = MODELE.fit(maxiter = 10000000000, method="ncg")

RES.summary()

MARGINAL_EFFECT = RES.get_margeff(at="mean", dummy=True)

Thanks a lot if you can help me.

0

There are 0 answers