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

Effect plots

One way to better understand the marginal effect of a unit change in price ratio is to use the logistic response model with some typical values and graph the predictions.

You can do this by using the function cplot() from the margins package. The function cplot() takes on the logistic.model object, the name of the predictor variable and the corresponding typical values as arguments. You assume the typical values for price.ratio to be in the range from -2 to 2. As you only want to investigate the predictions for a few values you define a sequence of numbers from -2 to 2 with increments 0.50 by using the function seq().

Bu egzersiz

Building Response Models in R

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

Egzersiz talimatları

  • Define a sequence of numbers ranging from -2 to 2 and having increments 0.50 by using the function seq(). Assign the result to an object named x.
  • Plot the predicted purchase probabilities given "price.ratio" and x by using the function cplot().

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Define the sequence of x values
x <- seq(from = ___, to = ___, by = ___)

# Plot the price.ratio effect
___(logistic.model, ___, xvals = ___)
Kodu Düzenle ve Çalıştır