Skip to main content

Unit 8

Introduction

Welcome to Week 8 of BIO144!

Learning objectives for the week

These learning objectives, together with the content of the course book chapter, define what you need to know for the exam.

After this unit, students will be able to:

  1. Identify biological questions and study designs in which the response variable is a count.
  2. Explain why linear models with normal errors are often inappropriate for count data (counts are non-negative integers, and their variance tends to increase with the mean).
  3. Describe the three components of a generalised linear model: the linear predictor, the distribution family and the link function.
  4. Use R to fit a Poisson regression with glm().
  5. Explain null and residual deviance as measures of fit for a GLM, analogous to sums of squares in a linear model.
  6. Check the assumptions of a Poisson GLM using diagnostic plots, recognising that QQ-plots of deviance residuals are interpreted differently from those of a linear model.
  7. Interpret coefficients on the log (link) scale, and back-transform them to multiplicative effects on the expected count.
  8. Use R to calculate predicted counts for given values of the explanatory variables.
  9. Use deviance-based tests to judge whether explanatory variables are associated with the response.
  10. Explain that in a chi-squared (likelihood ratio) test between nested GLMs, the degrees of freedom equal the difference in the number of estimated parameters.
  11. Detect overdispersion and select an appropriate response to it (e.g. a quasi-Poisson or negative binomial model).
  12. Recognise zero inflation in count data, and that it requires models beyond the Poisson GLM.
  13. Recognise a correct and complete statement of results from a Poisson regression.

Book chapter

This week we will be covering Chapter 8: Generalised linear models for count data of the course book.

Video and code walkthrough

Each chapter of the course book has a code walkthrough: an R script with the code of the chapter, with comments explaining each step, and a video in which Owen works through the script. Use them to learn the R code you need this week. Work through them before the practical, ideally running the script line by line while you watch the video. The last section of the script (“Practical toolbox”) shows code that the practical uses but the chapter does not.

Script: walkthrough_ch08_glm_count_data.R

To download the script straight into your RStudio project folder (for example on RStudio Server), run this line in the Console:

download.file("https://opetchey.github.io/BIO144_Course_Book/walkthroughs/walkthrough_ch08_glm_count_data.R", destfile = "walkthrough_ch08_glm_count_data.R")

Video: coming soon.

Lecture

Please attend the lecture. If for any reason you can’t, please watch the podcast, which is available on OLAT.

Optional: some ideas for how you could prepare for the lecture (no preparation is also fine) are in Preparing for lectures.

Homework, Practical, and Weekly Quiz

Available here. You will need to be on a UZH network to access this link, so if you are not on campus, you will need to connect to the UZH VPN first.