拟合一个选择模型
接下来,您将使用 mlogit 包中的 mlogit() 函数,对 sportscar 数据进行选择模型估计。数据已加载。这个过程与使用 lm() 拟合回归模型非常相似。
本练习是课程的一部分
R 中的营销选择建模
练习说明
- 使用
library()加载mlogit包。 - 拟合一个模型,将
choice作为由seat、trans、convert和price决定的函数。您需要补全公式输入。 - 汇总
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