Estimate parameter lambda
In the video you learned how the log link function provides for the linear combination in the parameters defining the Poisson regression model of the form
$$ log(\lambda)=\beta_0+\beta_1x_1 $$
To obtain the response function in terms of lambda we exponentiated the model function to obtain
$$ \lambda=E(y)=exp(\beta_0 + \beta_1x_1) $$ $$ \lambda=E(y)=exp(\beta_0) \times exp(\beta_1x_1) $$
In this exercise, you will use this formulation with the horseshoe crab data to compute the estimate of the mean \(y\) for the female crab width.
Dataset crab
is preloaded in the workspace.
Cet exercice fait partie du cours
Generalized Linear Models in Python
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Import libraries
import ____.____ as sm
from ____.formula.api import ____
# Fit Poisson regression of sat by width
model = ____('____ ~ ____', data = ____, family = ____.____.____).____
# Display model results
____(model.____)