1. Learn
  2. /
  3. Courses
  4. /
  5. Generalized Linear Models in Python

Exercise

Fitting a Poisson regression

Continuing with the crab dataset you will fit your first Poisson regression model in this exercise.

The crab dataset has been preloaded in the workspace.

Instructions

100 XP
  • Import statsmodels.api library as sm.
  • Import glm from statsmodels.formula.api.
  • Using Poisson() for the response distribution fit the Poisson regression with satas the response and weight for the explanatory variable.
  • Display the model results using .summary().