I have the following problem. I would like to do an in-sample prediction using logit
from statsmodels.formula.api
.
See my code:
import statsmodels.formula.api as smf
model_logit = smf.logit(formula="dep ~ var1 + var2 + var3", data=model_data)
Until now everything's fine. But I would like to do in-sample prediction using my model:
yhat5 = model5_logit.predict(params=["dep", "var1", "var2", "var3"])
Which gives an error ValueError: data type must provide an itemsize
.
When I try:
yhat5 = model5_logit.predict(params="dep ~ var1 + var2 + var3")
I got another error: numpy.core._exceptions._UFuncNoLoopError: ufunc 'multiply' did not contain a loop with signature matching types (dtype('<U32'), dtype('<U69')) -> None
How can I do in-sample forecast for the Logit model using from statsmodels.formula.api
?
This did not help me: How to predict new values using statsmodels.formula.api (python)