Generalized linear models (GLMs) refer to a larger framework of prediction techniques which can include linear regression, logistic regression (used to predict binary outcomes), and poisson regression (used to predict counts). They are a generalization of linear regression techniques which allow you to work with other distributions which have non-normal error terms. GLMs can be implemented in R by using the glm
package, in which you supply a link function to specify which distribution you are modeling. That makes it easier to work with different types of models within a single package, using standard syntax.
In Chapter 1, Getting Started with Predictive Analytics, our original example that we used to predict womens' heights based upon womens' weights used the lm
package. We could also have used the glm
package, specifying family=Gaussian
as the link function:
lm_output <- lm(women$height ~ women$weight)
or:
glm_output <- glm(women...