Preface

The chapters of this e-text were originally compiled by me and my colleagues for the course 161.726 Extensions to the Linear Model, which has been taught at Massey University for a number of years but has changed course code to move with the times. This text is the result of the most recent major re-vamp of the course.

The current staff can’t necessarily claim all the credit though. We have relied on work done by our predecessors — Greg Arnold, Doug Stirling, Debbie Leader, and Geoff Jones to name some of them. We’ve also been able to rely on a number of other references that discuss generalised linear models in particular.

We use R in almost every lecture; you should be able to run the code on your own. You should follow the instructions on how to get your own installation of R and RStudio on the help using R and RStudio in 161.331 page.

Many chapters refer to data stored in the ELMER add-on package. This package is not on CRAN. You will need to Download ELMER_2024.0.zip which is for Windows users, or Download ELMER_2023.0.tar.gz which is for all other operating systems. N.B. DO not unzip this download! You need to then point R or RStudio to this file when you “install from local archive” under the Packages tab. Find this tab down the bottom of the main window of RStudio, or a standard pull-down menu in R.

The material that follows makes use of tidyverse packages. Graphs are made using a mixture of base R graphics and ggplot functions, with the choice being made on the basis of convenience. There is no sense using a lot of effort if the graph is simple and will only be seen by the analyst. More effort is warranted if the graph is likely to be enriched or used for a presentation.

Please ask for help if you don’t understand the R code being demonstrated.

R is an open source (collaborative) project which benefits from its users sharing their work under what is known as a general public licence (GPL). You can read the full contents of the GPL, but my interpretation of the GPL is that you as the end user can only look to me to solve any errors in the document even if I’ve taken extracts from someone else’s work. I take every care to make sure that the document I provide is accurate, informative, and maybe even up to date, but in the end what you then do with any information taken from the document is your call. I’m starting to like the phrase, all care but no responsibility as a descriptor of the R project on the whole. Welcome aboard!

In the end, I must take responsibility for the errors that exist — even those of other contributors; it would of course be most helpful to me and other readers that anything that looks like an error is reported to me as soon as possible. Rest assured, updates of the book are fairly easy to prepare and distribute.

Feel free to let me know how you find the e-text by sending an e-mail to:

R is a collaborative project and development is ongoing. Most users do not need to update R with the release of every new version. I recommend staying with one R version for as long as you can. I only change versions to keep up with the latest version my students might be using and because some of the additional packages created by other R users are built on recent versions.

As it happens, this document was compiled using version 4.4.1. All code should work on future versions equally well. Please let me know if this is not the case.

Cheers,

Jonathan Godfrey