Skip to content

Instantly share code, notes, and snippets.

@jkclem
Last active November 1, 2024 15:18
Show Gist options
  • Save jkclem/42f504bd34ac6c07e8a513e7704757e6 to your computer and use it in GitHub Desktop.
Save jkclem/42f504bd34ac6c07e8a513e7704757e6 to your computer and use it in GitHub Desktop.
from statsmodels.discrete.discrete_model import Logit
# add an intercept since statsmodels does not
my_data['Intercept'] = 1
# fit the logistic regression model using MLE
mle_mod = Logit(my_data[target], my_data[['Intercept'] + vars_of_interest])
mle_mod_fit = mle_mod.fit(disp=False)
# print the summary
print(mle_mod_fit.summary())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment