11Generalised Linear Models
We saw in Section 10.5.8 that linear model assumptions may not be satisfied for our dataset, even after transformations. Fortunately, riding to our assistance are Generalised Linear Models or GLMs which are far more flexible and will also work with a much wider range of outcomes than linear models. Some examples of such outcomes are the following:
- Count data, such as the number of road accidents, where negative counts are not permitted;
- Binary data, such as dead or alive;
- Time to event (such as arrival of a train) data.
11.1 How GLMs work
This section offers a summary of the key features of GLMs: for more mathematical background and examples see, for instance, Dobson and Barnett, 2018. These features highlight the differences from and similarities to linear models.
11.1.1 Error structure
We saw in Chapter 10 that linear models have error terms that are assumed to have a Normal distribution. In practice, this may not be realistic, for instance we may have
- errors that are strongly skewed;
- errors that are strictly bounded (as in proportions);
- errors that cannot lead to negative fitted values (as in counts).
GLMs deal with this issue by assuming that the distribution of the outcome variable (s), given the covariates (s), and thus the error distribution, ...
Get The R Book, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.