Generalized Linear Models in Python
Ita Cirovic Donev
Data Science Consultant
Examples:
$$ P(y)=\frac{\lambda^ye^{-\lambda}}{y!} $$
import seaborn as sns
sns.distplot('y')
Response variable $$ y \sim Poisson(\lambda) $$
Mean of the response $$ E(y)=\lambda $$
Poisson regression model $$ log(\lambda)=\beta_0+\beta_1x_1 $$
import statsmodels.api as sm
from statsmodels.formula.api import glm
glm('y ~ x',
data = my_data,
family = sm.families.Poisson())
Generalized Linear Models in Python