将价格设为因子
正如我在上一个视频中提到的,您可以把价格视为因子。我们来估计一个这样的模型。chocolate 数据已加载。
本练习是课程的一部分
R 中的营销选择建模
练习说明
- 将
chocolate数据中的Price变量改为因子。 - 调用
mlogit,使用公式Selection ~ 0 + Brand + Type + Price在 chocolate 数据上拟合模型,并将结果赋给choc_m3。 - 使用
summary()查看模型系数。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# change the Price variable to a factor in the chocolate data
# fit a model with mlogit and assign it to choc_m3
# inspect the coefficients