1. Learn
  2. /
  3. Courses
  4. /
  5. Generalized Linear Models in R

Connected

Exercise

Refresher on fitting linear models

During this exercise, you'll see how a linear model is a special case of a generalized linear model (GLM). You will use the ChickWeight (docs) dataset that we introduced during the video. I have already extracted the last observed weights for you. With the dataset, you will see if Diet affects weight at the end of the study.

Recall from the video that a linear model looks like lm(formula = y ~ x, data = dat) and that a GLM looks like glm(formula = y ~ x, data = dat, family = 'family').

Instructions

100 XP
  • Fit a linear model with variable weight predicted by variable Diet using the chick_weight_end dataframe.
  • Fit a GLM using the same formula and data, but also include the gaussian family.