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

A logistic model for beer demand

The linear model does not fit the data when it comes to predicting purchase probabilities. You need a response function that bounds the model predictions between zero and one.

The logistic response function can do this job for you. Therefore, you will need the function glm(). The function glm() works very similar to the lm() function. The main difference is the additional family argument. As HOPPINESS is a binary variable, you have to specify the family argument as binomial.

Bu egzersiz

Building Response Models in R

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

Egzersiz talimatları

  • Explain HOPPINESS by price.ratio using the function glm() and the argument family = binomial. Assign the result to an object named logistic.model.
  • Obtain the coefficients of the logistic.model by using the function coef().

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Explain HOPPINESS by price.ratio
___ <- ___(___, family = ___, data = choice.data)

# Obtain the coefficients
Kodu Düzenle ve Çalıştır