LoslegenKostenlos loslegen

Fit a choice model

Okay, now that you've created the mlogit.data object called chocolate, you are ready to call mlogit() to fit a model. You might want to type head(chocolate) into the console so that you can look at the data while you fill in the inputs for the mlogit() function. The Selection column in chocolate contains the choice. It can be TRUE/FALSE, 0/1, or no/yes. The attributes are in the Brand, Type, and Price columns.

Diese Übung ist Teil des Kurses

Choice Modeling for Marketing in R

Kurs anzeigen

Anleitung zur Übung

  • Fill in the inputs to the mlogit command. The first input to mlogit() is always a formula. The formula should be Selection ~ Brand + Type + Price.
  • The second input to mlogit() should be data = chocolate.
  • For the third input to mlogit() use the option print.level = 3, which tells mlogit() to report more details on the maximum likelihood algorithm.
  • Once you've run mlogit and assigned the output to choc_m1, use the summary function to inspect the model output.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Fit a model with mlogit() and assign it to choc_m1
choc_m1 <- mlogit(___, ___, ___)

# Summarize choc_m1 with summary()
Code bearbeiten und ausführen