擬合一個選擇模型
接下來,你要使用 mlogit 套件中的 mlogit() 函式,搭配 sportscar 資料來估計一個選擇模型。資料已經載入。這個流程和用 lm() 擬合迴歸模型非常相似。
本練習屬於課程
R 的行銷選擇模型
練習說明
- 使用
library()載入mlogit套件。 - 擬合一個模型,以
seat、trans、convert和price作為解釋變數來預測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