Generalized Linear Models in Python
Ita Cirovic Donev
Data Science Consultant






Data type: continuous
Domain: $(-\infty,\infty)$
Examples: house price, salary, person's height
Family: Gaussian()
Link: identity
$g(\mu) = \mu = E(y)$
Model = Linear regression

Data type: binary
Domain: $0,1$
Examples: True/False
Family: Binomial()
Link: logit
Model = Logistic regression

Data type: count
Domain: $0, 1, 2, ..., \infty$
Examples: number of votes, number of hurricanes
Family: Poisson()
Link: logarithm
Model = Poisson regression
| Density | Link: $\eta=g(\mu)$ | Default link | glm(family=...) |
|---|---|---|---|
| Normal | $\eta = \mu$ | identity | Gaussian() |
| Poisson | $\eta = log(\mu)$ | logarithm | Poisson() |
| Binomial | $\eta = log[p/(1-p)]$ | logit | Binomial() |
| Gamma | $\eta = 1/\mu$ | inverse | Gamma() |
| Inverse Gaussian | $\eta = 1/\mu^2$ | inverse squared | InverseGaussian() |
Generalized Linear Models in Python