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.
Latihan ini adalah bagian dari kursus
Generalized Linear Models in Python
Petunjuk latihan
- Import
statsmodels.apilibrary assm. - Import
glmfromstatsmodels.formula.api. - Using
Poisson()for the response distribution fit the Poisson regression withsatas the response andweightfor the explanatory variable. - Display the model results using
.summary().
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# Import libraries
import ____.____ as sm
from ____.formula.api import ____
# Fit Poisson regression of sat by weight
model = ____('____ ~ ____', data = ____, family = ____.____.____).____
# Display model results
____(model.____)