Last active
December 25, 2018 03:25
-
-
Save glamp/5074027 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
train_cols = data.columns[1:] | |
# Index([gre, gpa, prestige_2, prestige_3, prestige_4], dtype=object) | |
logit = sm.Logit(data['admit'], data[train_cols]) | |
# fit the model | |
result = logit.fit() |
Any Idea why I am getting this error when running this logit code?
logit = sm.Logit(data['admit'], data[train_cols])
AttributeError: 'module' object has no attribute 'Logit'
I have been reading the documentation, and have read about endog, and exog. Have the format for the parameters changed or something? I can not seem to figure it out any ideas would be appreciated it!
Never mind,
found my problem
import statsmodels
instead of:
import statsmodels.api as sm
yeah!!!
use
import statsmodels as sm
instead of
import statsmodels.api as sm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think the Index comment here is wrong, it should include the Intercept column also, right? That really confused me at first! I thought you were creating the intercept column but then not actually using it in the model.
And thanks for the tutorial! It helped me out a lot, other than that one confusing part :)