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').
यह अभ्यास पाठ्यक्रम का हिस्सा है
Generalized Linear Models in R
अभ्यास निर्देश
- Fit a linear model with variable
weightpredicted by variableDietusing thechick_weight_enddataframe. - Fit a GLM using the same formula and data, but also include the
gaussianfamily.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Fit a lm()
lm(formula = ___ ~ ___, data = ___)
# Fit a glm()
glm(formula = ___ ~ ___ , data = ___, family = '___')