開始使用免費開始

擬合一個選擇模型

接下來,你要使用 mlogit 套件中的 mlogit() 函式,搭配 sportscar 資料來估計一個選擇模型。資料已經載入。這個流程和用 lm() 擬合迴歸模型非常相似。

本練習屬於課程

R 的行銷選擇模型

檢視課程

練習說明

  • 使用 library() 載入 mlogit 套件。
  • 擬合一個模型,以 seattransconvertprice 作為解釋變數來預測 choice。你需要自行填入公式的輸入。
  • 彙總 m1 物件。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# load the mlogit library 


# fit a choice model using mlogit() and assign the output to m1
m1 <- mlogit(___ ~ ___, data=sportscar)

# summarize the m1 object to see the output of the choice model
編輯並執行程式碼