Generalized linear models (GLM)
Gist
When an ordinary Linear regression (LM) regression doesn't cut it - maybe your response variable are whole integers or proportions bounded by
Mathematics
For an outcome
where the expected value of
Why isn't just using a transformation better?
An interesting thing I found online was the question of: Okay, why can't we just log-transform the response variable like:
The answer is that it it has to do with Jensen's inequality. The transformed model is actually estimating
Fitting
Done through Maximum likelihood
Binomial
Poisson
The link function for Poisson is a natural log
glm(Y~X, family = "poisson")
Note
- You can add an offset to account for different "efforts". The offset function tells the function to NOT estimate a coefficient for it.