BaşlayınÜcretsiz Başlayın

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').

Bu egzersiz

Generalized Linear Models in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • 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.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Fit a lm()
lm(formula = ___ ~ ___, data = ___)

# Fit a glm()
glm(formula = ___ ~ ___ , data = ___, family = '___')
Kodu Düzenle ve Çalıştır